@@ -55,7 +55,8 @@ export const createMockPlugin = (ctx: MockPluginContext) => createUnplugin(() =>
55
55
const mocksComponent : MockComponentInfo [ ] = [ ]
56
56
const importPathsList : Set < string > = new Set ( )
57
57
58
- walk ( ast as any , {
58
+ // @ts -expect-error mismatch between acorn/estree types
59
+ walk ( ast , {
59
60
enter : ( node , parent ) => {
60
61
// find existing vi import
61
62
if ( isImportDeclaration ( node ) ) {
@@ -259,7 +260,7 @@ export const createMockPlugin = (ctx: MockPluginContext) => createUnplugin(() =>
259
260
const plugins = ( config . plugins || [ ] ) as Plugin [ ]
260
261
261
262
// `vite:mocks` was a typo in Vitest before v0.34.0
262
- const vitestPlugins = plugins . filter ( p => ( p . name === 'vite:mocks' || p . name . startsWith ( 'vitest:' ) ) && ( p . enforce || ( p as any ) . order ) === 'post' )
263
+ const vitestPlugins = plugins . filter ( p => ( p . name === 'vite:mocks' || p . name . startsWith ( 'vitest:' ) ) && ( p . enforce || ( 'order' in p && p . order === 'post' ) ) )
263
264
const lastNuxt = findLastIndex (
264
265
plugins ,
265
266
i => i . name ?. startsWith ( 'nuxt:' ) ,
@@ -305,8 +306,8 @@ function isExpressionStatement(node: Node | null): node is ExpressionStatement {
305
306
}
306
307
// TODO: need to fix in rollup types, probably
307
308
function startOf ( node : Node ) {
308
- return 'range' in node && node . range ? node . range [ 0 ] : ( node as any ) . start as number
309
+ return 'range' in node && node . range ? node . range [ 0 ] : ( 'start' in node ? node . start as number : undefined as never )
309
310
}
310
311
function endOf ( node : Node ) {
311
- return 'range' in node && node . range ? node . range [ 1 ] : ( node as any ) . end as number
312
+ return 'range' in node && node . range ? node . range [ 1 ] : ( 'end' in node ? node . end as number : undefined as never )
312
313
}
0 commit comments