-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Introduce two new syntax for type declaration based on JSDoc
var myString: !string = 'hello world'; //non-nullable
var myString1: ?string = 'hello world'; // nullable
var myString2: string = 'hello world'; // nullable
var myString3 = 'hello world'; // nullable
by default type are nullable.
Two new compiler flag :
inferNonNullableType
make the compiler infer non-nullable type :
var myString3 = 'hello world' // typeof myString is '!string', non-nullable
nonNullableTypeByDefault
(I guess there might be a better name) :
var myString: !string = 'hello world'; // non-nullable
var myString1: string = 'hello world'; // non-nullable
var myString2: ?string = 'hello world'; // nullable
var myString3 = 'hello world' // non-nullable
michaelmesser, styfle, KeesCBakker, postpersonality, typeetfunc and 5 more
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript