Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import react from "@vitejs/plugin-react";
// separately via `npm run e2e` and must not be collected by vitest (their
// `test.describe` collides with vitest's global).
export default defineConfig({
plugins: [react()],
plugins: [react() as any],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Avoid using as any as it disables all type safety. Instead, you can cast the plugin to import('vite').PluginOption to resolve the type mismatch while maintaining type safety.

Alternatively, the recommended way to resolve type conflicts between Vite and Vitest is to import defineConfig from 'vite' and add a triple-slash reference directive at the top of the file:

/// <reference types="vitest" />
import { defineConfig } from 'vite';
Suggested change
plugins: [react() as any],
plugins: [react() as import('vite').PluginOption],

test: {
environment: "node",
include: ["src/**/*.{test,spec}.{ts,tsx}"],
Expand Down
Loading