|
|
|
|
|
by wwwigham
1682 days ago
|
|
> In TypeScript you can assign an instance of one class to an instance of another as long as they have compatible fields. Fun fact: If you add a private field to a class it'll behave nominally in TS. This is because private fields kinda require nominal relations to function. So, in a way, it does support "switching" to nominal type checking for classes - the opt in is simply per-class. |
|
[0] https://flow.org/en/docs/lang/variance/