Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TypeScript で型検査器を作る / Implementing a type checker with TypeScript

TypeScript で型検査器を作る / Implementing a type checker with TypeScript

katashin

June 09, 2017
Tweet

More Decks by katashin

Other Decks in Programming

Transcript

  1. ܕ෇͚نଇͷྫ • true: boolean • t: string ∧ u: U

    → (t + u): string • t: T ∧ u: T → (t === u): boolean • t: { u: U } → t.u: U ˢΛͦͷ··࣮૷͢Ε͹0,
  2. શମ૾ function typeOf(ast: ESTree.Node, scope: Var[]) { switch (ast.type) {

    case ‘BinaryOperator’: // … case ‘…’: default: this.errors.push({ message: ‘…’, start: …, end: … }) } }