let str:string = 'hello';
let age:number = 20;
let a:number[] = [1, 2, 3];
let a2:Array<number> = [1, 2, 3];
let week1:string[] = ['mon', 'tue', 'wed'];
let week2:Array<string> = ['mon', 'tue', 'wed'];
let b:[string,number];
b = ['z', 1];
//b = [1, 'z'];
function sayHello():void {
console.log('hello');
}
function showError():never {
throw new Error();
}
function infLoop():never {
while(true){
//do something...
}
}
enum: 열거형 변수, 관련된 상수들의 집합을 정의할 때 사용하는 특별한 타입
enum Os {
Window = 3,
iOS = 10,
Android
}
console.log(Os[10]); //iOS
console.log(Os['iOS']); //10
let myOs:Os;
myOs = Os.Window
let a:null = null;
let b:undefined = undefined;