Correct partial table types

`_display_data` is a cache keyed by force name, not a single record.
The auto complete accumulator starts empty, so its fields are optional.
Game commands have no usage beyond their own help text.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:18 +00:00
co-authored by Claude Opus 5
parent 1387b8a2db
commit d78ae40c5d
6 changed files with 9 additions and 6 deletions
+1
View File
@@ -50,6 +50,7 @@ function Search.prepare(custom_commands)
name = name,
description = locale_desc,
help_text = locale_desc,
usage = locale_desc,
aliases = {},
}
end
@@ -77,7 +77,8 @@ local function get_player_cache(player_index)
-- Create a new cache if the previous on is in use
if not cache or cache.task and not cache.task.completed then
cache = {} --[[@as any]]
--- @diagnostic disable-next-line: missing-fields
cache = {} --[[@as TreeDeconCache]]
end
local player = assert(game.get_player(player_index))
+2 -2
View File
@@ -277,8 +277,8 @@ local function apply_planners_in_area(player, area, machine_name, planner_with_p
-- Bounding box table to be reused in the loop below
--- @type BoundingBox
local param_area = {
left_top = {},
right_bottom = {}
left_top = { x = 0, y = 0 },
right_bottom = { x = 0, y = 0 },
}
-- Update area param table to be reused in the loop below
@@ -128,6 +128,7 @@ Elements.milestone_table = Gui.define("research_milestones/milestone_table")
do local _row_data = {}
--- @type ExpGui_ResearchMilestones.elements.milestone_table.row_data
--- @diagnostic disable-next-line: missing-fields
local empty_row_data = { color = font_color.positive }
--- Get the row data for a force and research
@@ -416,7 +416,7 @@ function Elements.eta_label.refresh(eta_label)
eta_label.tooltip = display_data.tooltip
end
do local _display_data = {} --- @type Elements.eta_label.display_data
do local _display_data = {} --- @type table<string, Elements.eta_label.display_data>
--- Refresh the eta label for all online players
function Elements.eta_label.refresh_online()
-- Refresh the row data for online forces
+1 -1
View File
@@ -207,7 +207,7 @@ end
function ExpUtil.auto_complete(options, input, use_key, rtn_key, use_pattern)
input = input:lower()
local plain = use_pattern ~= true
local found = {} --- @type { length: number, index: number, start: boolean, value: any }
local found = {} --- @type { length: number?, index: number?, start: boolean?, value: any }
for k, v in pairs(options) do
local str = use_key and k or v
local index = str:lower():find(input, nil, plain)