Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Dissoc0<
- D extends string,
- O extends Record<D, any>
- > = {[K in keyof O]: (Record<D, never> & Record<string, K>)[K]}
- type Dissoc<
- D extends string,
- O extends Record<D, any>,
- // issue 16018
- Foo extends Dissoc0<D, O> = Dissoc0<D, O>
- > = {[K in Foo[keyof O] & keyof O]: O[K]}
- // example
- type Input = { X: 1, Y: 2, Z: 3 }
- type Expected = { Y: 2, Z: 3 }
- type Output = Dissoc<'X', Input>
- type Check<
- To extends Output = Expected,
- From extends Expected = Output
- > = never
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement