Created
February 17, 2016 21:13
-
-
Save logentries-gists/47c2544a3aa909395357 to your computer and use it in GitHub Desktop.
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
| interface TeamColours { | |
| colour: “red” | “blue” | “white”; | |
| } | |
| class Team { | |
| constructor(colours: TeamColours){ | |
| this.colours = colours; | |
| } | |
| } | |
| new Team({ colour: “Black” }) // Error: Type ‘”Black”’ is not assignable to type ‘“red” | “blue” | “white”’ | |
| new Team({ colour: “blue” }); // Works, colour is allowed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment