Skip to content

Instantly share code, notes, and snippets.

@RodrigoNovais
Created January 9, 2023 06:19
Show Gist options
  • Save RodrigoNovais/616c36de1dee83a89da59a2329e768e5 to your computer and use it in GitHub Desktop.
Save RodrigoNovais/616c36de1dee83a89da59a2329e768e5 to your computer and use it in GitHub Desktop.
Make properties optional in TypeScript
export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment