swc-project / jest

Super-fast alternative for babel-jest or ts-jest without type checking. Please use main repository for issues
758 stars 37 forks source link

Weird behavior for objects using TS4.9 `satisfies` keyword #130

Closed blixt closed 1 year ago

blixt commented 1 year ago

I ran into a very strange error that took me a while to narrow down, but I finally figured out it's @swc/jest (or @swc/core) failing to handle the new satisfies keyword in TypeScript 4.9.

In short, the bug is that values imported from other modules are not found by swc when they are referenced inside of an object that has the satisfies operator. It's as if the object becomes a scope that is not able to access the imported values. Values in the same module can be referenced, however.

I made a repro here: https://github.com/blixt/test-swc-jest-bug (run yarn && yarn jest to see the error)

Screenshot 2022-11-25 at 01 46 31
blixt commented 1 year ago

I verified it now works with the latest versions of all packages.