-
Notifications
You must be signed in to change notification settings - Fork 450
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
[Bug]: TS 5.2 - TypeError: toSorted is not a function #4204
Labels
Comments
koni1234
changed the title
[Bug]: TS 5.2 - TypeError: [1,3,2].toSorted is not a function
[Bug]: TS 5.2 - TypeError: toSorted is not a function
Sep 4, 2023
using Node v20.6.1 it works |
Yes, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
29.1.1
Steps to reproduce
TS config:
{ "compilerOptions": { // ..., "target": "ES6", "module": "ESNext", "moduleResolution": "Node", "lib": ["ES2023", "DOM"], } }
Jest config:
{ preset: 'ts-jest', testEnvironment: 'jsdom', testEnvironmentOptions: { customExportConditions: ['node', 'node-addons'], }, setupFiles: ['<rootDir>/tests/unit/jest.init.ts'], transform: { '^.+\\.ts$': ['ts-jest', { isolatedModules: true }], // ... }, // ..., };
create a simple test like this one
describe('',() => { it('test toSorted', () => { expect([1, 3, 2].toSorted()).toStrictEqual([1, 2, 3]); }); });
Expected behavior
I should see the test passed
Actual behavior
Test fail with this error:
TypeError: [1,3,2].toSorted is not a function
Debug log
https://justpaste.it/ckwj8
Additional context
Typescript checks and build work fine, the problem seems to be present only in unit tests.
Environment
System: OS: macOS 13.2 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Binaries: Node: 18.14.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.3.1 - /usr/local/bin/npm npmPackages: jest: ^29.6.2 => 29.6.2
The text was updated successfully, but these errors were encountered: