You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OK, right that make sense. Although now that Class means something to javascript (a specific implementation) -- using structural typing when specifying a class seems "wrong". If I was using an interface, I totally agree.
But what actually sent me down this path was I originally tried this:
functiononlyA(o: A){if(oinstanceofA){console.log("onlyA - is A",o.value);return;}console.log("onlyA - not A",o.value);}
TypeScript Version: 2.1.4
Code
Playground link
Expected behavior:
I would expect the lines marked
bad
above to cause compile errors. I would expect this behavior when using interfaces, but not with classes.Actual behavior:
Compiles without errors.
The text was updated successfully, but these errors were encountered: