Skip to main content

Exclude | Typescript

  • Exclude | Typescript

  • Funciona apenas para uniões
// Example of using Exclude in TypeScript. It's an union
type MyUnion = string | number | boolean;

// Exclude the "boolean" type from the union
type MyFilteredUnion = Exclude<MyUnion, boolean>;

// Result: MyFilteredUnion is now "string | number"