The type signature given for a number of functions in the draft API docs has an
... or nil
component.
’nil’ is, I think, a visitor from the outer space of the ObjC / Swift types, and is not the name of a value that can really be returned by a JavaScript function, whose only options in that semantic zone are null or possibly undefined.
Perhaps worth a global search and replace to protect any users who might be detained by puzzlement or fruitless searches through JS references for an elusive ‘nil’ ?
(My guess is that most of these functions actually return null rather than undefined. See the example of Canvas.graphicWithId()
below)
If a graphic with a given id exists:
cnv.graphicWithId(14)
-> [object Shape]
and if no such id is found:
cnv.graphicWithId(97)
-> null
cnv.graphicWithId(97) === null
-> true
We can test for equality with null, but not with 'nil’