Is there a way to omit multiple keys at once without explicitly listing them, assuming they are already known from a specific interface?
Consider the following interfaces:
interface A {
a: number;
b: number;
c: number;
d: number;
}
interface B extends A {
e: string;
f: string;
}
I want to create a type that refers to an object like this:
const a: SomeType = {
e: 'foo',
f: 'bar',
};
I could use the Omit utility but it would be repetitive:
type OmitWithKeys = Omit<B, 'a' | 'b' | 'c' | 'd'>
This issue persists if B has numerous keys:
type BWithoutExtend = {
e: string;
f: string;
};
Is there a clever workaround for this situation?