Skip to content

Instantly share code, notes, and snippets.

@pffigueiredo
Last active February 7, 2023 15:23
Show Gist options
  • Save pffigueiredo/33e920d30e602a4aa94e4c9f5063e766 to your computer and use it in GitHub Desktop.
Save pffigueiredo/33e920d30e602a4aa94e4c9f5063e766 to your computer and use it in GitHub Desktop.
Useful types to hack around
// prettify intersection on types, like `a & b & c`
type Prettify<T> = {[K in keyof T]: T[K]} & {};
// autocomplete that also accepts string
// so you still have intellisense but it's open to any string
type AutoComplete<T extends string> = T | (string & {});
// the value of objects
type ValueOf<T extends object> = T[keyof T];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment