Typescript Basics

  • set up typing - tsconfig.json
  • typings.d.ts
  • library --> typing

Why Typescript?

  • compile error vs. run time error

Types

Type Example
string value: string
numeric value: number
boolean value: boolean
function value: (input: string) => string
object value: {[key: string]: any}
js array of type value: string[]
void void
custom type value: MyClass

Features

  • abstract class
  • interface
  • enum
  • encapsulation modifier: public, private, protected
  • static variable, method modifier

Conversion

  • string to number: +text

results matching ""

    No results matching ""