wasmoon icon indicating copy to clipboard operation
wasmoon copied to clipboard

Can't use null in a table

Open timstableford opened this issue 4 years ago • 1 comments

If a JS API explicitly needs the null value within an object it's not currently possible.

Eg

jsFunc({
  a = 10,
  b = nil
})

Will generate a JS object like this:

{ a: 10 }

That's because nil works far more like JS's undefined than null.

I think the best solution is adding a null type extension and setting the global "null" to this type extension allowing it to be used like a primitive.

timstableford avatar Jun 01 '21 12:06 timstableford

Indeed, and it should be under injectObjects flag

ceifa avatar Jul 22 '21 13:07 ceifa