Make the @as casts actually apply

emmylua only parses the inline cast as `--[[@as T]]`, the spaced form
`--[[ @as T ]]` is treated as a plain comment, so all 149 of them were
doing nothing.

LuaGuiElement.style is a union because a style name can be assigned to
it, so reading it back needs the cast.

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 fd2f5a9589
commit 164672602d
32 changed files with 151 additions and 148 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ function Toolbar.set_button_toggled_state(define, player, state, _from_left)
button.style = state and toolbar_button_active_style or toolbar_button_default_style button.style = state and toolbar_button_active_style or toolbar_button_default_style
-- Make the extra required adjustments -- Make the extra required adjustments
local style = button.style local style = button.style --[[@as LuaStyle]]
style.minimal_width = original_width style.minimal_width = original_width
style.maximal_height = original_height style.maximal_height = original_height
if button.type == "sprite-button" then if button.type == "sprite-button" then
+1 -1
View File
@@ -55,7 +55,7 @@ Elements.open_action_bar = Gui.define("player_list/open_action_bar")
--- @param highlighted boolean --- @param highlighted boolean
function Elements.open_action_bar.set_highlight(open_button, highlighted) function Elements.open_action_bar.set_highlight(open_button, highlighted)
open_button.style = highlighted and "tool_button" or "frame_button" open_button.style = highlighted and "tool_button" or "frame_button"
local style = open_button.style local style = open_button.style --[[@as LuaStyle]]
style.padding = -2 style.padding = -2
style.width = 8 style.width = 8
style.height = 14 style.height = 14
+4 -2
View File
@@ -261,7 +261,8 @@ define_tab(
local rules = Gui.elements.scroll_table(container, scroll_height, 1) local rules = Gui.elements.scroll_table(container, scroll_height, 1)
rules.style = "bordered_table" rules.style = "bordered_table"
rules.style.cell_padding = 4 local rules_style = rules.style --[[@as LuaStyle]]
rules_style.cell_padding = 4
for i = 1, 15 do for i = 1, 15 do
Gui.elements.centered_label(rules, frame_width - 30, { "exp-gui_readme.rules-" .. i }) Gui.elements.centered_label(rules, frame_width - 30, { "exp-gui_readme.rules-" .. i })
@@ -287,7 +288,8 @@ define_tab(
local commands = Gui.elements.scroll_table(container, scroll_height, 2) local commands = Gui.elements.scroll_table(container, scroll_height, 2)
commands.style = "bordered_table" commands.style = "bordered_table"
commands.style.cell_padding = 0 local commands_style = commands.style --[[@as LuaStyle]]
commands_style.cell_padding = 0
for name, command in pairs(Commands.list_for_player(player)) do for name, command in pairs(Commands.list_for_player(player)) do
Gui.elements.centered_label(commands, 120, name) Gui.elements.centered_label(commands, 120, name)
@@ -312,7 +312,8 @@ function Elements.science_table.refresh_row(science_table, row_data)
-- Update the icon -- Update the icon
local icon = row.icon local icon = row.icon
icon.style = row_data.icon_style icon.style = row_data.icon_style
icon.style.height = 55 local icon_style = icon.style --[[@as LuaStyle]]
icon_style.height = 55
-- Update the element visibility -- Update the element visibility
row.net_suffix.visible = true row.net_suffix.visible = true