-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Library version
2.0.2
Describe the bug
Adding node-fetch
dependency breaks resolution of type definitions with TypeScript 5.7.3 while bundling for browser.
TS starts to pick types from @node/types
instead of lib.dom.d.ts
.
For example setInterval
type resolution:
2.0.1 = TS picks from lib.dom.d.ts
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/setInterval) */
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
2.0.2 = TS picks from @types/node
function setInterval<TArgs extends any[]>(
callback: (...args: TArgs) => void,
ms?: number,
...args: TArgs
): NodeJS.Timeout;
Different return type of the funtion breaks the project.
I guess that the core reason is unwanted installation of the @types/node
dependency.
Expected behavior
Types checking in the project must be the same regardless of the ua-parser-js library version.
Additional context
a part of package.json
"engines": {
"node": ">=18.0.0"
},
"dependencies": {
"bootstrap": "^5.3.3",
"gsap": "^3.12.7",
"perfect-scrollbar": "^1.5.6",
"swiper": "^11.2.3",
"ua-parser-js": "2.0.2",
"vue": "^3.5.13",
"vue-router": "^4.5.0",
"vuescroll": "^5.1.1",
"vuex": "^4.1.0"
},
"devDependencies": {
"@stylistic/eslint-plugin-ts": "^3.1.0",
"@types/eslint": "^9.6.1",
"@vitejs/plugin-vue": "^5.2.1",
"@vue/compiler-sfc": "^3.5.13",
"eslint": "^9.20.1",
"eslint-plugin-vue": "^9.32.0",
"sass": "1.79.5",
"typescript": "~5.7.3",
"typescript-eslint": "^8.24.0",
"vite": "^6.1.0",
"vue-eslint-parser": "^9.4.3",
"vue-tsc": "^2.2.0"
}
Workaround
Downgrade ua-parser-js
back to 2.0.1.
P. S. That was a breaking-change actually.
mtbadi39 and hbbrawer-twitch
Metadata
Metadata
Assignees
Labels
No labels