Suggestion: non-nullable type · Issue #185 · microsoft/TypeScript (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@fdecampredon

Description

@fdecampredon

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 :

var myString3 = 'hello world' // typeof myString is '!string', non-nullable

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