Let's say i have an array of types:
const arr: Foo[]: [
a: Foo<A>,
b: Foo<B>,
c: Foo<C>,
];
How to limit the array to be NOT a type
const arr: Foo<Not<B>>[]: [
a: Foo<A>,
b: Foo<B>, // error
c: Foo<C>,
];
One way of doing that is to use the Exclude utility type to specify a susbet of the type parameters that Foo can accept, something like this
type Foo<T> = {
value: T
}
type Bar = string | boolean | number
type BarWithoutBoolean = Exclude<Bar, boolean>
const arr: Foo<BarWithoutBoolean>[] = [
{ value: 1 },
{ value: "abc" },
{ value: true } // Err
]
Foois defined?