Is it possible to declare a TypeScript interface for a plain JavaScript class?
e.g.
function Foo(bar)
{
this.bar=bar;
}
var x=new Foo("test"); // x is shown as any
I'd like to declare an interface for Foo:
interface IFoo
{
bar: string;
}
But I can't figure out how to declare it.
function Foo(bar: string) : IFoo
{
this.bar=bar;
}
Gives me "'Foo' declared a non-void return type, but has no return expression."
(I don't want to rewrite Foo as a TypeScript class.)