typechecked optargs constructors for GitRunner

This commit is contained in:
Alexander Courtis
2024-11-06 16:53:01 +11:00
parent eab49e3d6d
commit b2f7b9a876
2 changed files with 43 additions and 38 deletions

View File

@@ -128,8 +128,8 @@ function M.reload_project(toplevel, path, callback)
return
end
---@type GitRunnerOpts
local runner_opts = {
---@type GitRunnerArgs
local args = {
toplevel = toplevel,
path = path,
list_untracked = git_utils.should_show_untracked(toplevel),
@@ -139,14 +139,14 @@ function M.reload_project(toplevel, path, callback)
if callback then
---@param path_xy GitPathXY
runner_opts.callback = function(path_xy)
args.callback = function(path_xy)
reload_git_project(toplevel, path, project, path_xy)
callback()
end
GitRunner:run(runner_opts)
GitRunner:run(args)
else
-- TODO #1974 use callback once async/await is available
reload_git_project(toplevel, path, project, GitRunner:run(runner_opts))
reload_git_project(toplevel, path, project, GitRunner:run(args))
end
end