2018-04-17から1日間の記事一覧

TypeScriptにおけるobject typeのunionの、あまり期待されてないのではないかと思われる挙動について

結論 Discriminated Union ( http://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions ) を使おう サンプルコード 'use strict'; type A = { a: string } type B = { b: number } type C = { c: boolean } type T = A|B|C …