Comments (15)
https://github.com/CerusBots/api/blob/master/patches/pony-cause%2B1.1.1.patch I made this patch using patch-package
and it works but @benasher44's fix doesn't work sing umzug is unhappy then
from pony-cause.
There is now a PR to TS by @iamharbie that fixes this: microsoft/TypeScript#49639
Lets hope it get merged and released soon
from pony-cause.
@SpencerKaiser Thanks for bringing it to mine and their attention 🙏 I replied in that thread asking if they would want me to backport the fix to 1.x
from pony-cause.
TS 4.8 is now released. If you update to that one then everything will work as it should thanks to the corrected lib.d.ts
: https://devblogs.microsoft.com/typescript/announcing-typescript-4-8/#lib-d-ts-updates
from pony-cause.
Published 2.1.0
that contains a fix for TS 4.6 and TS 4.7, as those two versions likely never will be fixed by TS
from pony-cause.
Thanks to everyone in the thread for the help! And an extra shoutout to @RossComputerGuy for the patch 🚀
@voxpelli not sure if you're familiar with umzug
, but I started a discussion over there for them to add your patch 🙂
from pony-cause.
We're running into the same issue. Any plans to look into this?
from pony-cause.
Updating the constraint for the Error generic parameter for cause like this fixes it:
ErrorWithCause<T extends Error | undefined = undefined>
from pony-cause.
We did the same and just patched unzug as well to pass Error instead of unknown cc @mmkal
from pony-cause.
Relates to microsoft/TypeScript#48098, and as @ljharb said in DefinitelyTyped/DefinitelyTyped#59354 (comment):
the bug is in the base error cause types
And microsoft/TypeScript#45167 (comment) is still open for this very reason.
I note that there's also another incorrect Error
related type in TS, that the type of .stack
while being optional is not explicitly allowed to be undefined
: microsoft/TypeScript#45748
So: We have to fix this in TS.
In the meanwhile: You can downgrade to an older version of TS, like eg. TS 4.5, to avoid this error.
from pony-cause.
Would by the way love a PR with a test case that reproduces this, so that we can more easily verify that its working again 👍
from pony-cause.
Doing some more pinning down on when this was introduced:
- This is caused by
"lib": ["es2022"]
or more specifically thees2022.error
lib.esnext
will includees2022
on TS4.6
and later. - No
es2022
stuff is documented in the onlinelib
documentation, but in the TS4.6.4
CLI it is documented:Argument for '--lib' option must be: 'es5', 'es6', 'es2015', 'es7', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'esnext', 'dom', 'dom.iterable', 'webworker', 'webworker.importscripts', 'webworker.iterable', 'scripthost', 'es2015.core', 'es2015.collection', 'es2015.generator', 'es2015.iterable', 'es2015.promise', 'es2015.proxy', 'es2015.reflect', 'es2015.symbol', 'es2015.symbol.wellknown', 'es2016.array.include', 'es2017.object', 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'es2017.typedarrays', 'es2018.asyncgenerator', 'es2018.asynciterable', 'es2018.intl', 'es2018.promise', 'es2018.regexp', 'es2019.array', 'es2019.object', 'es2019.string', 'es2019.symbol', 'es2020.bigint', 'es2020.promise', 'es2020.sharedmemory', 'es2020.string', 'es2020.symbol.wellknown', 'es2020.intl', 'es2021.promise', 'es2021.string', 'es2021.weakref', 'es2021.intl', 'es2022.array', 'es2022.error', 'es2022.object', 'es2022.string', 'esnext.array', 'esnext.symbol', 'esnext.asynciterable', 'esnext.intl', 'esnext.bigint', 'esnext.string', 'esnext.promise', 'esnext.weakref'.
The onlinelib
documentation do state the very true:
This list may be out of date lib
will default to the value oftarget
, so iftarget
ises2022
oresnext
on TS4.6
or later then it will include the troublesome newError
definition. And the onlinetarget
documentation does indeed documentes2022
So, conclusion: You can also avoid this issue by setting lib
implicitly through target
or explicitly to something that doesn't include es2022.error
from pony-cause.
I have now merged #36 which added tests that reproduces this very fact.
from pony-cause.
The mentioned PR has now been merged into TS: microsoft/TypeScript#49639
Not sure in what release it's going to appear. I hope it's going to be in at least TS 4.8
from pony-cause.
#41 proves that current upcoming TS does indeed solve this issue.
from pony-cause.
Related Issues (11)
- Dependency Dashboard
- Test in browsers, using eg. GH Actions + Playwright HOT 1
- Action Required: Fix Renovate Configuration
- Add an `AggregateError` with cause? HOT 1
- Add an ESM variant + make tree shakeable HOT 3
- Ensure/validate proper prototype chain for `ErrorWithCause`
- Include stack less errors in `stackWithCauses`?
- Highlight list of helpers separately in readme + add a simple ToC
- Fix type regression in `tsnext` which throws `TS2463` HOT 5
- Ensure `ErrorWithCause` can be subclassed properly with types
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pony-cause.