cf.completefrontend

Write the codeMedium

Write MyOmit<T, K> without the built-in Omit, and make it reject keys that T doesn't have.

The built-in Omit<Todo, "descripton"> compiles and quietly keeps description. MyOmit should remove the keys in K, keep each remaining property's modifiers, and report a key that isn't in T.

Write this
type MyOmit<T, K extends PropertyKey> = T; // drop the keys in K type Todo = { title: string; description: string; done: boolean }; // type Preview = MyOmit<Todo, "description">;// { title: string; done: boolean }// MyOmit<Todo, "descripton"> should be an error

Solve it in the editor

The answer

Write it yourself first. Then compare it with a reference solution and the checks it passes.

Checking your sign-in…