Open
Description
Perhaps TS should be able to identify Object.assign(this, ...)
then infer the properties that are assigned to this
? Or is this not possible to do? I am not sure.
TypeScript Version:
Version 3.0.3
Search Terms:
- object assign
- class
- does not exist on type
Code
A.js
export default class A {
constructor ({ x, y, z }) {
Object.assign(this, {x, y, z});
}
f () {
return this.x;
}
}
Expected behavior:
TS should be able to identify x
as a property of this
.
Actual behavior:
Throwing:
Property 'x' does not exist on type 'A'.
Related Issues:
no
Side Note:
I am using TS with Javascript because YouCompleteMe switched to using TSServer for semantic completion. I absolutely love TS so was really happy about the switch! Thanks for the great work!