-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript error #35
Comments
We're running into the same issue. Any plans to look into this? |
Updating the constraint for the Error generic parameter for cause like this fixes it: ErrorWithCause<T extends Error | undefined = undefined> |
https://github.com/CerusBots/api/blob/master/patches/pony-cause%2B1.1.1.patch I made this patch using |
We did the same and just patched unzug as well to pass Error instead of unknown cc @mmkal |
Relates to microsoft/TypeScript#48098, and as @ljharb said in DefinitelyTyped/DefinitelyTyped#59354 (comment):
And microsoft/TypeScript#45167 (comment) is still open for this very reason. I note that there's also another incorrect 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. |
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 👍 |
Doing some more pinning down on when this was introduced:
So, conclusion: You can also avoid this issue by setting |
I have now merged #36 which added tests that reproduces this very fact. |
See voxpelli/pony-cause#35 pony-cause is used by Umzug, so yeah, until that's resolved ES2022 is off limits.
There is now a PR to TS by @iamharbie that fixes this: microsoft/TypeScript#49639 Lets hope it get merged and released soon |
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 |
…error` on TS `4.8` by @voxpelli This commit fixes the following error, which appears when running TS `^4.8.0-dev.20220707` with eg. ` npx tsc --lib es2020,es2022.error,es2021.promise` or ` npx tsc --lib esnext` > error TS2425: Class 'Error' defines instance member property 'cause', but extended class 'VError' defines it as instance member function. Discovered in voxpelli/pony-cause#41 when looking to extend the tests for voxpelli/pony-cause#35 to detect whether the nightly of `4.8.0` now correctly fixes that, following the merge of microsoft/TypeScript#49639
#41 proves that current upcoming TS does indeed solve this issue. |
Published |
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 |
@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 |
TS 4.8 is now released. If you update to that one then everything will work as it should thanks to the corrected |
The text was updated successfully, but these errors were encountered: