Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
blobs
on Feb 1, 2020
|
parent
|
context
|
favorite
| on:
TypeScript’s quirks: How inconsistencies make the ...
Whatever words you use, it simply conflicts with basic JS and is a serious flaw.
const cat = new Cat(); if (cat instanceof Dog) console.log('this should never be possible!');
What is this strange protective behavior towards TS, can we stick to logic please?
redmorphium
on Feb 1, 2020
[–]
instanceof checks the prototype chain, which is a different concept from type. Prototype chains are dynamic and exist at runtime, while Typescript types are a static concept.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: