Suppose there is the following interfaces and function:
export interface Parent {
[argument: string]: unknown;
}
interface Child extends Parent {
something: number;
name: string;
}
function func(foo: Omit<Child, 'name'>): number {
return foo.something;
}
TypeScript complains that Type 'unknown' is not assignable to type 'number'.
. I sorta kinda understand why this is, but I'm not sure how to overcome it to achieve what I want (aka for foo
to be the same type as Child
but with name
not required).
Note that I don't have access to change neither Child
nor Parent
.
Any help would be appreciated, thanks!