-
-
Notifications
You must be signed in to change notification settings - Fork 390
Open
Description
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Type Checking
Expected Behaviour
? is not a type, and should only be used when marking fields as optional. If nil is explicitly allowed as a value, | nil should be used. This is in line with TypeScript.
Actual Behaviour
? does not add | nil to the value type, and the second option should be disallowed.

Reproduction steps
---@class Foo
---@field foo? string
---@field bar string?
---@field baz string | nil
local test = {};
function Foo()
return test.foo, test.bar, test.baz
end;Additional Notes
No response
Log File
No response
Metadata
Metadata
Assignees
Labels
No labels