Skip to content

Instantly share code, notes, and snippets.

@edubskiy
Last active June 29, 2023 12:59
Show Gist options
  • Save edubskiy/6b9d786d37ff550a126d64c2b910c117 to your computer and use it in GitHub Desktop.
Save edubskiy/6b9d786d37ff550a126d64c2b910c117 to your computer and use it in GitHub Desktop.
type PartiallyRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
interface Human {
name: string;
age?: number;
}
type HumanWithRequiredAge = PartiallyRequired<Human, "age">;
const dan: HumanWithRequiredAge = {
name: "Dan Jordan",
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment