Skip to content

Instantly share code, notes, and snippets.

@olibooty
Created June 11, 2024 12:46
Show Gist options
  • Select an option

  • Save olibooty/7b44d6100f956c4e92d36db72c3979e0 to your computer and use it in GitHub Desktop.

Select an option

Save olibooty/7b44d6100f956c4e92d36db72c3979e0 to your computer and use it in GitHub Desktop.
/**
* Renders supplied properties of an object required
*/
type Requirer <T, K extends keyof T> = T & { [P in K]-?: T[P] }
interface Foo {
opt?: string;
}
type ReqFoo = Requirer<Foo, 'opt'>
@olibooty
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment