'Utility Types that extend other Interfaces
I know that I can use utility types in type script, e.g. Pick, to build other types. But let's say after I Pick some of the properties from an interface, I want that new type to extend another interface.
export interface ICreateRequestVo {
};
export interface IFoo {
foo: string;
bar: string;
};
export type FooRequestVo = Pick<IFoo, 'foo'>;
Now when I try to make FooRequestVo extends ICreateRequestVo, I get the following error:
export type FooRequestVo = Pick<IFoo, 'foo'> extends ICreateRequestVo;
TS1005: '?' expected.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
