JavaScript with types
Default target is ES3, pretty old. Use --target es2015
for browsers, and --target esnext
for servers.
Good to have noImplicitAny
and strictNullChecks
on.
Always prefer using interface
over type
unless explicitly needed.
type
can alias existing types (or interfaces): type Username = string | IUsername
.type ColorAndCircle = Color & Circle
is an intersection of two interfaces.