-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
vitest doesn't support TypeScript 5.2's using feature #4183
Comments
Start a new pull request in StackBlitz Codeflow. |
This reverts commit 9a30697. Blocked by vitest-dev/vitest#4183
Vitest just uses Vite which uses esbuild. Until esbuild is updated in their dependencies (maybe it already is, and you just need to update versions?) you can use the resolutions/overrides field: For pnpm: {
"overrides": {
"esbuild": "^0.19.3"
}
} For yarn: {
"resolutions": {
"esbuild": "^0.19.3",
}
} |
I thought esbuild was only used for dependencies, not for application code? In any case, that override doesn't appear to fix the issue. Also, |
Vitest uses |
I fixed this issue by setting import { defineConfig } from 'vitest/config';
export default defineConfig({
esbuild: { target: 'es2022' },
}); |
The current workaround is to use @nedsalk's config. The issue should be fixed when Vitest 1.0 is released. |
Describe the bug
TypeScript 5.2 supports an upcoming ES feature,
using
: https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/The syntax doesn't get transpiled by vitest, and then tests fail with the following error:
When I run the files that use the
using
syntax with https://github.com/esbuild-kit/tsx, it works just fine.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-uk35mv?file=tsconfig.json,test%2Fbasic.test.ts&initialPath=__vitest__/
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: