Union Types

【TypeScript】Union Types から特定の型を取り除くには?

Union Types から特定の型を取り除く => Exclude type Sample1 = Exclude<string | number | boolean, string | boolean>; // number 逆に、Union Types から特定の型を抽出する場合は => Extract type Sample2 = Extract<string | number | boolean, string | boolean>; // string | boolean 参考ページ</string></string>