Type Annotations

Primitive Types

Primitive Types

  • boolean
  • number
  • string
  • symbol
  • null
  • undefined

Literal Types

  • true, false
  • 100 ...
  • 'hello' ...

Object Types

  • object
  • Primitive Types 의 정반대
  • object 로 지정된 유형은 boolean, number, string, symbol, null, undefined 가 될 수 없다는 것을 의미함.
declare function create(o: object | null): void;

create({ prop: 0 }); // OK
create(null); // OK

create(42); // Error
create("string"); // Error
create(false); // Error
create(undefined); // Error

Never Types

  • 내용

Any Types

  • 내용

Unknown Types

  • 내용

Array Types

  • 내용

Tuple Types

  • 내용

Enum Types

  • 내용

Void Types

  • 내용

Function Types

  • 내용

Type Aliases

  • 내용

Union Types

  • 내용

Interface Types

  • 내용

Class Types

  • 내용

Type Annotations

By Woongjae Lee

Type Annotations

  • 659