Created
May 31, 2022 05:20
-
-
Save ehatricksmith/c65de56e01316aac8fe9afb39494fab1 to your computer and use it in GitHub Desktop.
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
/** | |
* Nominal typing for any TypeScript interface or class. | |
* | |
* If T is an enum type, any type which includes this interface | |
* will only match other types that are tagged with the same | |
* enum type. | |
* | |
* See <https://stackoverflow.com/a/37074697/253686> | |
*/ | |
export interface Nominal<T> { | |
"nominal structural brand": T; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment