Git Product home page Git Product logo

Comments (15)

RossComputerGuy avatar RossComputerGuy commented on June 13, 2024 2

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.

voxpelli avatar voxpelli commented on June 13, 2024 2

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.

voxpelli avatar voxpelli commented on June 13, 2024 2

@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.

voxpelli avatar voxpelli commented on June 13, 2024 2

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.

voxpelli avatar voxpelli commented on June 13, 2024 1

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.

SpencerKaiser avatar SpencerKaiser commented on June 13, 2024 1

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.

floriankrueger avatar floriankrueger commented on June 13, 2024

We're running into the same issue. Any plans to look into this?

from pony-cause.

benasher44 avatar benasher44 commented on June 13, 2024

Updating the constraint for the Error generic parameter for cause like this fixes it:

ErrorWithCause<T extends Error | undefined = undefined>

from pony-cause.

benasher44 avatar benasher44 commented on June 13, 2024

We did the same and just patched unzug as well to pass Error instead of unknown cc @mmkal

from pony-cause.

voxpelli avatar voxpelli commented on June 13, 2024

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.

voxpelli avatar voxpelli commented on June 13, 2024

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.

voxpelli avatar voxpelli commented on June 13, 2024

Doing some more pinning down on when this was introduced:

  1. This is caused by "lib": ["es2022"] or more specifically the es2022.error lib. esnext will include es2022 on TS 4.6 and later.
  2. No es2022 stuff is documented in the online lib documentation, but in the TS 4.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 online lib documentation do state the very true:
    This list may be out of date

  3. lib will default to the value of target, so if target is es2022 or esnext on TS 4.6 or later then it will include the troublesome new Error definition. And the online target documentation does indeed document es2022

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.

voxpelli avatar voxpelli commented on June 13, 2024

I have now merged #36 which added tests that reproduces this very fact.

from pony-cause.

voxpelli avatar voxpelli commented on June 13, 2024

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.

voxpelli avatar voxpelli commented on June 13, 2024

#41 proves that current upcoming TS does indeed solve this issue.

from pony-cause.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.