fix: resolve luacats return-type-mismatch and cast-local-type warnings
Problem: lua-language-server reports two diagnostics in override.lua: char() returns string? but resolve() annotates its return as string, and fallback_icon is typed as string but assigned a string? value. Solution: add fallback values so both assignments satisfy the string type — resolve() falls back to fallback_icon, and fallback_icon falls back to an empty string.
This commit is contained in:
parent
6f445c30d6
commit
7d35b23ba0
1 changed files with 2 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ local fallback_icon
|
|||
local function resolve(name, ext)
|
||||
local key = resolve_mod.resolve_name(name, ext)
|
||||
if key then
|
||||
return char(key)
|
||||
return char(key) or fallback_icon
|
||||
end
|
||||
return fallback_icon
|
||||
end
|
||||
|
|
@ -32,7 +32,7 @@ function M.apply()
|
|||
return
|
||||
end
|
||||
|
||||
fallback_icon = char('file')
|
||||
fallback_icon = char('file') or ''
|
||||
|
||||
local orig_get_icon = devicons.get_icon
|
||||
devicons.get_icon = function(name, ext, opts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue