Description
Proposal
The TypeScript spec says that Undefined
is the subtype of all types (see 3.2.6).
The keyword Undefined
or Nothing
should be added to the language to refer to the type of undefined
.
typeof(undefined)
currently yields any
. This should be corrected to return the undefined type.
Detail
See http://en.wikipedia.org/wiki/Bottom_type & http://james-iry.blogspot.com/2009/08/getting-to-bottom-of-nothing-at-all.html
The neat thing about structural typing TypeScript is that you don't need to explicitly think about generic type variance. Instead, when you use two generic implementations of non-identical types, then TypeScript uses the input and return types of the different methods and properties to figure out if these two generic types are subtypes or not.
One missing feature, however, seems to be a bottom Nothing/None/Nil type that is a subtype of all types. This then allows us to create neat "empty" types in generic.