-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
incorrect this and class instance with inheritation #12097
Comments
See #10166 |
@falsandtru #10166 is related but not the solution. I tried other class inheritances and it turns out the problem is not particular to see another example: (With Typescript 2.1 latest) class CustomObject extends Object {
constructor(message) {
super()
this.message = message
}
}
const obj = new CustomObject('a')
console.log(obj instanceof CustomObject) Expected output: true Actual: false You can try a playground demo(with Typescript 2.0.x) Conclusion: PS: One interesting thing is Babel also transpile it incorrectly |
I wrote my solution in that issue. |
compromising solution in #12123 |
Due to design limitation, close this |
TypeScript Version: 2.1.0-dev.20161107
Code
Expected behavior:
transpiled:
Actual behavior:
transpiled:
The wrong behavior is result from #11846 and #11868.
The text was updated successfully, but these errors were encountered: