Cannot find name 'ErrorOptions'.
ohonigx opened this issue ยท 19 comments
Hi,
via
"@zxing/library": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@zxing/library/-/library-0.19.1.tgz",
"integrity": "sha512-rKwvl3Uuqs8yf364iU9l3HDDaIx8yPv+CH6DbtQaQr67VdKLG22G1ukEp9fOdDefE6tpLtRAdMnTrgtpiaKAZw==",
"requires": {
"@zxing/text-encoding": "~0.9.0",
"ts-custom-error": "^3.0.0"
}
},
i got a new
ERROR in node_modules/ts-custom-error/dist/custom-error.d.ts:3:45 - error TS2304: Cannot find name 'ErrorOptions'.
today.
i can't find any ErrorOptions class here and the github universe, please help,
thanks
also i've had this error today , when i find 3.3.0 was released, turning back to 3.2.2 solved, anyway i think that ErrorOptions interface came from typescript compiler options about libs, you shuld try to add in lib section of the compiler options "ES2022.error"
Same issue here :/
Same issue here, can't compile my angular9 project since using zxing 3.3.0.
I've encountered the same issue because we're using @zxing/library, which references any version >=3.0.0
Changing the version in the package.lock to 3.2.2 fixed this temporarily.
package.json
"ts-custom-error":"3.2.2",
and all is fine again ..
i can't find any ErrorOptions class here and the github universe, please help,
it's from https://github.com/microsoft/TypeScript/blob/main/lib/lib.es2022.error.d.ts
yep, it's a thing ;)
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
https://v8.dev/features/error-cause
But now I have to find an elegant way to introduce it without breaking your builds ;)
But now I have to find an elegant way to introduce it without breaking your builds ;)
:-) Thanks to the others here i solved it with the new entry in package.json "ts-custom-error":"3.2.2", so the zxing/library is happy again. Thanks for your work and the fast reponse!
Hi, @adriengibrat
we use dependency "@zxing/ngx-scanner": "3.0.0", which still creates the following in package_lock.json`:
"@zxing/library": {
"version": "0.15.2",
"resolved": "https://registry.npmjs.org/@zxing/library/-/library-0.15.2.tgz",
"integrity": "",
"requires": {
"text-encoding": "^0.7.0",
"ts-custom-error": "^3.0.0"
},
"dependencies": {
"ts-custom-error": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/ts-custom-error/-/ts-custom-error-3.3.0.tgz",
"integrity": ""
}
}
},
"@zxing/ngx-scanner": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@zxing/ngx-scanner/-/ngx-scanner-3.0.0.tgz",
"integrity": "",
"requires": {
"@zxing/library": "^0.15.1",
"tslib": "^1.9.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": ""
}
}
},
Seems it still considers 3.3.0 as the latest.
I tried npm i ts-custom-error
in some other place and it still shows,
"dependencies": {
"ts-custom-error": "^3.3.0",
}
I think it still recognize 3.3.0 as latest.
Hello I have the same problem as @RandulaKoralage . We use @zxing/ngx-scanner which underneath uses @zxing/library which uses "ts-custom-error": "^3.0.0". Therefore I cannot edit this dependency
On my rather new npm it is handled correctly, i.e. deprecated module is skipped and last correct version is installed.
However, on other place where my npm is quite old and I cannot update, it keeps taking the deprecated version and therefore the build fails
Could you completely remove the version 3.3.0 from npm? If the lib is broken then it does not help anyone. Is there any other reason why it still needs to be kept in npm repository?
Regards
Antoni
in React, @zxing/library still installs 3.3.0, so I installed "ts-custom-error" v3.2.2 as a dev dependency.
npm i -dev ts-custom-error@3.2.2
For all those who still have issue because dependency tree still install 3.3.0,
you may try to
upgrade typescript >=4.6
& add :
"lib: [...,"ES2022", "ES2022.error"],
in your tsconfig.json
see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-6.html#--target-es2022
Unfortunately it is not an option for me. My current version of Angular does not allow to upgrade typescript to that version and upgrading Angular is also not possible for me at the moment.
I've released a 3.3.1 version where i copy the typescript ErrorOption interface to avoid the error, I hope this should definitively fix the issue.
Please, confirm the 3.3.1 compiles on your projects, then i'll close the issue.
My build works again! :) thank you
Finally! @adriengibrat my build also worked. Thank you.
OK, it's fixed. Thanks for your feedback.