Let's imagine we have a TypeScript Interface like this
export interface IMyObj {
id: string;
type: 'AA' | 'AZ' | 'XY';
...
}
Now, I require another interface that includes the same type
field
export interface IMyOtherObj {
...
type: 'AA' | 'AZ' | 'XY';
...
}
As you can see, there is duplication in the values of type
. So my question is, how can I reuse the IMyObj.type
within my IMyOtherObj
interface? I attempted the following
export interface IMyOtherObj {
...
type: IMyObj.type; // -> error
...
}
I believe I'm on the right track but haven't been successful so far, any ideas?