Reputation: 107
I know there were some intricacies with timeouts in AngularJS, and was wondering how it works in Angular (latest). Looking at the definitions set in index.d.ts, I see the following definition:
declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer;
So, I thought that I'm using the setTimeout function from Node.js API, but when I checked the compiled code, there's no mentioning of the NodeJS.Timer, and setTimeout remains unchanged.
So, I guess it turns into window.setTimeout on compile? Did anyone run into this?
Upvotes: 1
Views: 4172
Reputation:
The definition is made for the developper, not for the final product : in Javascript, variables aren't typed, and don't implement interfaces (or aren't instance of classes).
This means that somewhere in your definitions, you will a NodeJS.Timer
interface, that will give you all the properties of that interface. But it could have been called HeyDude.WhereIs.MyCar
, this wouldn't have made a difference.
Bottom line is, don't bother with that, that's just code completion. If you have another question, feel free to ask it in your question.
Upvotes: 1