Last active
October 6, 2018 17:16
-
-
Save dewey92/64ef12e208dd8af0993c42c1e0447fa7 to your computer and use it in GitHub Desktop.
Branding example
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 function convertCtoF(degree: Celcius): Fahrenheit; | |
| declare const fiveC: Celcius; | |
| declare const fiveF: Fahrenheit; | |
| convertCtoF(fiveF); // error :) | |
| // Argument of type 'Brand<"Fahrenheit", number>' is not assignable to parameter of type 'Brand<"Celcius", number>'. | |
| // Type 'Brand<"Fahrenheit", number>' is not assignable to type '{ _brand: "Celcius"; }'. | |
| // Types of property '_brand' are incompatible. | |
| // Type '"Fahrenheit"' is not assignable to type '"Celcius"'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment