I've a BaseType and a BabyType.
export type BaseType = {
id: string
}
export type BabyType = BaseType & {
name: string
};
I have generic layer where <T extends BaseType>
. Actually item is a 'BabyType' object.
updateItem(item: T): Promise<T> {
console.log(data) // {id: '6495f70a317b446b083f', name: 'Test'}
In this layer I want to remove 'id' (dynamically) from the data but I want to keep all key what defined in BabyType.
So the excepted result:
console.log(data) // {name: 'Test'}
I've tried
type OmitType = Omit<T, keyof BaseType>;
console.log(data as OmitType)
but it does not work. id
still logged in console.
Is there any solution to remove all key/value what are come from BaseType.