Skip to content

Instantly share code, notes, and snippets.

@DimitryDushkin
Last active November 2, 2022 14:15
Show Gist options
  • Save DimitryDushkin/7bf7741810492e8d8fa088740360eca1 to your computer and use it in GitHub Desktop.
Save DimitryDushkin/7bf7741810492e8d8fa088740360eca1 to your computer and use it in GitHub Desktop.
$Values from Flow in Typescript
type $Values<O extends object> = O[keyof O];
const obj = {
RU: 'ru',
EN: 'en',
} as const;
type vals = $Values<typeof obj>; // vals === 'ru' | 'en';
@BALEHOK
Copy link

BALEHOK commented Sep 30, 2019

awesome! thank you Dimitry

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