TypeScript のユニオン型の最初に書くパイプ |
が謎だった。次みたいなやつ。
type A =
| string // <- この | なに?
| number
| boolean;
type B = string | number | boolean; // <- これと同じなのに
この機能が入った時のissueがGitHubにあった。
Suggestion: Allowing leading pipe in union type declarations · Issue #12071 · microsoft/TypeScript