Created
August 27, 2021 10:16
-
-
Save eamonnboyle/fc1a9f5f494725300203234854a81bcd to your computer and use it in GitHub Desktop.
Only conditions are Aliased
This file contains 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
let primitiveType = typeof primitive; | |
switch (primitiveType) { | |
case "number": return primitive.toFixed(2); // No narrowing - compiler error | |
case "string": return primitive.toUpperCase(); // No narrowing - compiler error | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment