How do I exclude an index signature from a type?
Answer
There is no general way to do this for something that has an index signature.
Alternative
Get the keys before adding the index signature:
interface Foo {}
interface BarCore {
a: string;
b: boolean;
c: Foo;
}
type Bar = BarCore & {
[index: string]: any;
}
type X = keyof BarCore; // a|b|c
More
PS: try not to mix index signatures with valid prop at root level. Instead use the nested object pattern