Combining a destructure with the Omit
type, you could do something like:
export const deleteProperty = <T, K extends keyof T>(obj: T, id: K): Omit<T, K> => {
const { [id]: _, ...newState } = obj;
return newState;
};
CLICK HERE to find out more related problems solutions.