Last active
August 9, 2019 08:23
-
-
Save dewey92/c4e06ef1242668e36018b053e6c0765e to your computer and use it in GitHub Desktop.
New Type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| declare const _phantom: unique symbol; | |
| export type NewType<Name, Type> = Type & { [_phantom]?: Name }; | |
| export type Celcius = NewType<'Celcius', number>; | |
| export type Fahrenheit = NewType<'Fahrenheit', number>; | |
| // ...etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment