fix: resolve lua typecheck warnings in race and scraper
Problem: luals flagged undefined-field on uv timer methods because race_state.timer was untyped, and undefined-field on env_extra/stdin because they were missing from the run_scraper opts annotation. Solution: hoist race_state.timer into a typed local before the nil check so luals can narrow through it; add env_extra and stdin to the opts inline type in run_scraper.
This commit is contained in:
parent
de5a20c567
commit
e79f992e0b
2 changed files with 5 additions and 4 deletions
|
|
@ -114,12 +114,13 @@ function M.start(platform, contest_id, language)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.stop()
|
function M.stop()
|
||||||
if not race_state.timer then
|
local timer = race_state.timer
|
||||||
|
if not timer then
|
||||||
logger.log('No active race', vim.log.levels.WARN)
|
logger.log('No active race', vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
race_state.timer:stop()
|
timer:stop()
|
||||||
race_state.timer:close()
|
timer:close()
|
||||||
race_state.timer = nil
|
race_state.timer = nil
|
||||||
race_state.platform = nil
|
race_state.platform = nil
|
||||||
race_state.contest_id = nil
|
race_state.contest_id = nil
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ end
|
||||||
---@param platform string
|
---@param platform string
|
||||||
---@param subcommand string
|
---@param subcommand string
|
||||||
---@param args string[]
|
---@param args string[]
|
||||||
---@param opts { sync?: boolean, ndjson?: boolean, on_event?: fun(ev: table), on_exit?: fun(result: table) }
|
---@param opts { sync?: boolean, ndjson?: boolean, on_event?: fun(ev: table), on_exit?: fun(result: table), env_extra?: table<string, string>, stdin?: string }
|
||||||
local function run_scraper(platform, subcommand, args, opts)
|
local function run_scraper(platform, subcommand, args, opts)
|
||||||
if not utils.setup_python_env() then
|
if not utils.setup_python_env() then
|
||||||
local msg = 'no Python environment available (install uv or nix)'
|
local msg = 'no Python environment available (install uv or nix)'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue