Skip to content

Commit a0d248e

Browse files
committed
fix(cli): drop redundant type assertions in project injector
TS infers the narrowed types after `typeof project === 'function'` and `typeof project === 'object' && project !== null`, so the explicit casts trip `typescript(no-unnecessary-type-assertion)`.
1 parent 2610920 commit a0d248e

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

packages/cli/src/define-config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
defineConfig as viteDefineConfig,
66
type ConfigEnv,
77
type TestProjectConfiguration,
8-
type TestProjectInlineConfiguration,
98
type UserProjectConfigFn,
109
} from 'vitest/config';
1110
import type { InlineConfig as VitestInlineConfig } from 'vitest/node';
@@ -135,9 +134,8 @@ function injectPluginIntoProject(project: TestProjectConfiguration): TestProject
135134
return project;
136135
}
137136
if (typeof project === 'function') {
138-
const fn = project as UserProjectConfigFn;
139137
const wrapped: UserProjectConfigFn = (env: ConfigEnv) => {
140-
const result = fn(env);
138+
const result = project(env);
141139
if (result instanceof Promise) {
142140
return result.then(injectPluginIntoInlineConfig);
143141
}
@@ -149,7 +147,7 @@ function injectPluginIntoProject(project: TestProjectConfiguration): TestProject
149147
return project.then(injectPluginIntoInlineConfig);
150148
}
151149
if (typeof project === 'object' && project !== null) {
152-
return injectPluginIntoInlineConfig(project as TestProjectInlineConfiguration);
150+
return injectPluginIntoInlineConfig(project);
153151
}
154152
return project;
155153
}

0 commit comments

Comments
 (0)