Open
Description
From @BrunnerLivio on May 8, 2017 9:1
- VSCode Version: 1.12.1
- OS Version: Ubuntu 16.04.1 LTS (Xenial Xerus)
Example code:
MyController.js
// @ts-check
class MyController {
getWorld() {
return this.world; // <--- Marked as error
}
}
angular
.module('myApp')
.component('myComponent', {
bindings: {
'world': '<'
},
controller: MyController,
template: `<div>Hello {{$ctrl.getWorld()}}</div>`
});
The this.world
is marked as error, as supposed to be. But it is actually pretty annoying, because in angular you need to use quite often those component bindings. I know there's the option // @ts-ignore
, but that really pollutes the code and makes it less readable.
An extensions for this would be really useful.
I use this workaround at the moment
// @ts-check
class MyController {
constructor() {
this.world = this.world;
}
getWorld() {
return this.world;
}
}
[...]
I don't like this at all, but better than writing // @ts-ignore
.
Is there any other option / workaround?
Copied from original issue: microsoft/vscode#26192