You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
It would be nice of the Hybrid Types section could include an example function returning the hybrid type as was done in the posting, and further explain that one cannot create a TypeScript class that implements a hybrid type interface.
function getCounter():Counter{
var counter = function(start:number){};
counter.interval = 123;
counter.reset = function(){};
return counter;
}
var c: Counter = getCounter();
...
The text was updated successfully, but these errors were encountered:
starksm64
added a commit
to starksm64/TypeScript-Handbook
that referenced
this issue
Apr 24, 2015
I was having a hard time understanding how one would create a class implementing a hybrid type, and then ran across this posting which explained this issue:
http://stackoverflow.com/questions/25340601/typescript-hybrid-type-implementation
It would be nice of the Hybrid Types section could include an example function returning the hybrid type as was done in the posting, and further explain that one cannot create a TypeScript class that implements a hybrid type interface.
function getCounter():Counter{
var counter = function(start:number){};
counter.interval = 123;
counter.reset = function(){};
return counter;
}
var c: Counter = getCounter();
...
The text was updated successfully, but these errors were encountered: