I see this example in the Typescript handbook:
interface Counter {
(start: number): string;
interval: number;
reset(): void;
}
var c: Counter;
c(10);
c.reset();
c.interval = 5.0;
But when I try to do c(10);
or set c.interval = 5.0
I get an error -
Cannot set property 'interval' of undefined
I know I can do:
var c: Counter;
c = function(s: number){
return "'" + s + "'";
}
What's missing - (or is this an incomplete example) ?
Update:
There is a similar question - which answers this question, although, I still find this example convoluted.