You are on page 1of 1

strict object literal checking

Module
Freshness
Global

type StrOrNum = string|number; Type Alias

T&U Intersection Type


DefinitelyTyped
string | number Union Type
which files
Compilation Context
Generics compiler options

Type Declaration Space


:TypeAnnotation Declaration Spaces
Variable Declaration Space

var myPoint: { x: number; y: number; }; :{ / Structure/ } Inline Type Annotation


Modules

compose multiple type annotations into a single file for common types, interfaces,
global.d.ts
zero runtime JS impact Interfaces global namespace

implements browser
Project
ambient declarations common JS stuff JS envs
string node.js
type annotation TypeScript
number Primitive Types --noLib

boolean
lib.d.ts ?

[] to any valid type annotation Arrays


automatically included in the compilation context

any Compiler target effect

--strictNullChecks null --lib


Special Types
--strictNullChecks undefined tsconfig.json no runtime

Ambient Declarations overloading just documention


void
functions not arrow function
: [string, number] Tuple Type

organize a collection of related values Enums Callable Newable ?

is a declaration file .d.ts extension

JavaScript is valid TypeScript

narrow down the type within a conditional block


Type Guard
typeof

instanceof
no any runtime is not casting
inferred type
in Type Assertion
as foo vs. <foo>

a compile time construct

Double assertion
the assertion from type S to T succeeds ?
either S is a subtype of T

or T is a subtype of S