You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Btw, do you have strictNullCheck set to true in your tsconfig.json, or is the | null always necessary for function parameters that can be null?
Yes I use strict mode as recommended in the TS docs, it includes all other strict modes from what I gather. I'm actually not sure if the error would show up in regular mode. I've only ever used strict mode because the type safety is of utmost importance IMO (coming from a C background!). And really it's the official recommendation anyway. I will check without it and report back.
c56e986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also need to add a null in the tile parameter type to make the TS compiler happy:
setTile(x : number, y : number, tile : Tile | null, flags? : number) : void
c56e986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@user72356 Thanks! I've added it now (81eef50).
Btw, do you have
strictNullCheck
set totrue
in yourtsconfig.json
, or is the| null
always necessary for function parameters that can benull
?c56e986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I use strict mode as recommended in the TS docs, it includes all other strict modes from what I gather. I'm actually not sure if the error would show up in regular mode. I've only ever used strict mode because the type safety is of utmost importance IMO (coming from a C background!). And really it's the official recommendation anyway. I will check without it and report back.