Is it possible to maintain type coverage on a function that deeply removes all instances of a key in an object?
My function looks like this.
function omitDeep<T extends object>(obj: T, key: string): TWithoutProvidedKey {
return JSON.parse(
JSON.stringify(obj),
(key: string, value: any) => key === "__typename" ? undefined : value
);
}
Run Code Online (Sandbox Code Playgroud)
Is there any way to make TWithoutProvidedKey a reality?
typescript ×1