Skip to content

Type checking not working across scopes #2351

Closed Answered by carsakiller
Peter-Oestergaard asked this question in Q&A
Discussion options

You must be logged in to vote

The language server is treating playerSprite as either playdate.graphics.sprite or nil, because, like you said, the setup function theoretically could not run.

You can mark the type of playerSprite as playdate.graphics.sprite at its definition:

---@type playdate.graphics.sprite
local playerSprite = nil

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Peter-Oestergaard
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
feat/LuaCats Annotations Related to Lua Language Server Annotations (LuaCats) feat/type check Related to the type checking feature
2 participants