Skip to content

Commit

Permalink
docs(several): get rid of some false positive anno warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpalpha committed Oct 14, 2024
1 parent b0e9c4c commit c36edfb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions components/infobox/commons/infobox_person.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ function Person:_setLpdbData(args, links, status, personType)
local team = args.teamlink or args.team
if team and mw.ext.TeamTemplate.teamexists(team) then
local teamRaw = mw.ext.TeamTemplate.raw(team)
-- can not be nil due to above check in the if
---@cast teamRaw - nil
teamLink = teamRaw.page
teamTemplate = teamRaw.templatename
end
Expand Down Expand Up @@ -469,8 +471,10 @@ function Person:_createTeam(team, link)
---@cast link -nil

if mw.ext.TeamTemplate.teamexists(link) then
local data = mw.ext.TeamTemplate.raw(link)
link, team = data.page, data.name
local teamRaw = mw.ext.TeamTemplate.raw(link)
-- can not be nil due to above check in the if
---@cast teamRaw - nil
link, team = teamRaw.page, teamRaw.name
end

return Page.makeInternalLink({onlyIfExists = true}, team, link) or team
Expand Down
2 changes: 2 additions & 0 deletions components/infobox/extensions/commons/player_introduction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,8 @@ function PlayerIntroduction._displayTeam(team, date)

if mw.ext.TeamTemplate.teamexists(team) then
local rawTeam = mw.ext.TeamTemplate.raw(team, date)
-- can not be nil due to above check in the if
---@cast rawTeam - nil
return ' [[' .. rawTeam.page .. '|' .. rawTeam.name .. ']]'
end

Expand Down
2 changes: 2 additions & 0 deletions components/match2/wikis/dota2/match_page.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ function MatchPage.getByMatchId(props)
return
end
local teamTemplate = mw.ext.TeamTemplate.raw(opponent.template)
-- can not be nil due to above check in the if
---@cast teamTemplate - nil

opponent.iconDisplay = mw.ext.TeamTemplate.teamicon(opponent.template)
opponent.shortname = teamTemplate.shortname
Expand Down
2 changes: 2 additions & 0 deletions components/match2/wikis/leagueoflegends/match_page.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ function MatchPage.getByMatchId(props)
return
end
local teamTemplate = mw.ext.TeamTemplate.raw(opponent.template)
-- can not be nil due to above check in the if
---@cast teamTemplate - nil

opponent.iconDisplay = mw.ext.TeamTemplate.teamicon(opponent.template)
opponent.shortname = teamTemplate.shortname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ end
---@param value string|number
---@return string
function MatchesTable._bestof(value)
return Abbreviation.make('Bo' .. value, 'Best of ' .. value)
return Abbreviation.make('Bo' .. value, 'Best of ' .. value) --[[@as string]]
end

return MatchesTable
2 changes: 1 addition & 1 deletion definitions/mw.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ mw.ext.TeamTemplate = {}

---@param teamteplate string
---@param date string|number?
---@return {templatename: string, historicaltemplate: string?, shortname: string, name: string, bracketname: string, page: string, icon: string, image: string, legacyimage: string, legacyimagedark: string}|nil
---@return {templatename: string, historicaltemplate: string?, shortname: string, name: string, bracketname: string, page: string, icon: string, image: string, imagedark: string, legacyimage: string, legacyimagedark: string}|nil
function mw.ext.TeamTemplate.raw(teamteplate, date) end

---@param teamteplate string
Expand Down

0 comments on commit c36edfb

Please sign in to comment.