If some of the @types
packages refers to @types/node
via <reference types='node' />
then the global Node typings will be taken into account and they will override setInterval
and setTimeout
signatures (it changes the return value from number
to NodeJS.Timer
) for example.
Related links:
- microsoft/TypeScript#18588
- microsoft/TypeScript#31148
- microsoft/TypeScript#32273
- DefinitelyTyped/DefinitelyTyped#21310
- DefinitelyTyped/DefinitelyTyped#33015
- DefinitelyTyped/DefinitelyTyped#34036
To solve this problem, we use the Yarn resolutions functionality to replace the @types/node
package with one that contains almost no types:
{
"resolutions": {
"@types/node": "@appulate/loose-node-types-for-web-projects",
}
}