Here is the code:
interface Foo
{
c : string
}
function foo()
{
var c = this.c
return c
}
foo.call({ c : "quux" })
Visual Studio says that this : any
so autocompletion of this.c
doesn't work. How do I add a signature to tell that this
implements Foo
so IDE has type info for autocompletion of this.
inside foo
?
simply create a temp variable:
var self:Foo = this;
var c = self.c
return c
There is an open issue to specify what this
means in an arbitrary context that you can vote/contribute to : https://typescript.codeplex.com/workitem/507