Last active
April 29, 2018 04:00
-
-
Save phpsmarter/6d46aa7fd03e9762b934b542b1188f25 to your computer and use it in GitHub Desktop.
typescript cheatsheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
any | |
void | |
boolean | |
number | |
string | |
null | |
undefined | |
string[] /* or Array<string> */ | |
[string, number] /* tuple */ | |
string | null | undefined /* union */ | |
never /* unreachable */ | |
//------------------------ | |
---- | |
//Declarations | |
let isDone: boolean | |
let isDone: boolean = false | |
function add (a: number, b: number): number { | |
return a + b | |
} | |
// Return type is optional | |
function add (a: number, b: number) { ... } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment