Closed bradleyayers closed 7 years ago
I've been using it to mean 'can be null, undefined, or missing completely', but getdocs itself doesn't assign any precise semantic meaning to it (since it's just an extractor, not any kind of type checker), and you can use it whichever way suits your style in your own projects.
I'd like some clarification on what does nullable mean?
Here's my understanding: (questions in bold)
null
, or not be passed at all. Can it accept undefined?null
andstring
match?string
, butundefined
does not.What are the rules for nullable object properties, e.g.
Which of the following adhere to that type:
{ bar: null, baz: "baz" }
{ bar: undefined, baz: "baz" }
{ baz: "baz" }
{ bar: "bar", baz: "baz" }
I'm guessing 1, 3, 4.
How about class properties? e.g.
str
be absent from aFoo
instance? e.g.foo.hasOwnProperty('str') === false
?str
beundefined
or onlynull
?Can you think of any other cases that might warrant a more specific description?