Skip to content

Commit

Permalink
docs: Mention how to remove a tile.
Browse files Browse the repository at this point in the history
Closes #3159
  • Loading branch information
bjorn committed Oct 12, 2021
1 parent 1b7f9f9 commit c56e986
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/scripting-doc/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,8 @@ interface TileLayerEdit {

/**
* Sets the tile at the given location, optionally specifying tile flags.
*
* To remove a tile, set it to ``null``.
*/
setTile(x : number, y : number, tile : Tile , flags? : number) : void

Expand Down

3 comments on commit c56e986

@user72356
Copy link

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

@bjorn
Copy link
Member Author

@bjorn bjorn commented on c56e986 Nov 25, 2021

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 to true in your tsconfig.json, or is the | null always necessary for function parameters that can be null?

@user72356
Copy link

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 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.

Please sign in to comment.