As we continue to try and stengthen our types, using TypeScript's 'strictNullChecks' option means all properties on NSDAL classes unable to accept nul. However, for NSDAL objects for most fields we DO want to support null because that's how we indicate clearing a field value. i.e. if you set it to null it empties the field value. So, this simple helper type is something we can start using on record classes to indicate which fields can/should be assignable to null. It really is just a shorthand for writing something like string | null ( same as Nullable<string>) but with code completion you can save keystrokes using Nullable. Also it makes it clear by name rather than thinking about union types (|).
As we continue to try and stengthen our types, using TypeScript's 'strictNullChecks' option means all properties on NSDAL classes unable to accept
nul
. However, for NSDAL objects for most fields we DO want to supportnull
because that's how we indicate clearing a field value. i.e. if you set it tonull
it empties the field value. So, this simple helper type is something we can start using on record classes to indicate which fields can/should be assignable to null. It really is just a shorthand for writing something likestring | null
( same asNullable<string>
) but with code completion you can save keystrokes using Nullable. Also it makes it clear by name rather than thinking about union types (|).