Currently the language does not allow one to express that an entry in an array can be null.
Currently we can express
- Array is optional:
name?: string[]
- Array is nullable:
name: string[]?
- Array is optional and nullable:
name?: string[]?
Possible construct:
string?[] - might look strange if string?[]? - not sure we can express it in the grammer
string() - looks like a function call
nullable<string>[] - eats another keyword and from an editing point of view it feels wrong
string | null[] - feels wrong because then we'd express null always using | null instead of ?
another option might be that we change the syntax to create defined an array:
array<string> - array of strings
array<string>? - array of strings or null
array<string?> - array of strings/null
array<string?>? - arrary of string/null or null
this has the disavantage that for the default case the string[] this looks strange and unnatural and we'd add another keyword to the language
Currently the language does not allow one to express that an entry in an array can be
null.Currently we can express
name?: string[]name: string[]?name?: string[]?Possible construct:
string?[]- might look strange ifstring?[]?- not sure we can express it in the grammerstring()- looks like a function callnullable<string>[]- eats another keyword and from an editing point of view it feels wrongstring | null[]- feels wrong because then we'd express null always using| nullinstead of?another option might be that we change the syntax to create defined an array:
array<string>- array of stringsarray<string>?- array of strings or nullarray<string?>- array of strings/nullarray<string?>?- arrary of string/null or nullthis has the disavantage that for the default case the
string[]this looks strange and unnatural and we'd add another keyword to the language