File tree 3 files changed +3
-20
lines changed
nextjs/src/export-mocks/navigation
nextjs-vite/src/export-mocks/navigation
3 files changed +3
-20
lines changed Original file line number Diff line number Diff line change 1
- import type { MockInstance , Mock as MockV2 } from '@vitest/spy' ;
1
+ import type { Mock , MockInstance } from '@vitest/spy' ;
2
2
import {
3
3
type MaybeMocked ,
4
4
type MaybeMockedDeep ,
@@ -33,24 +33,7 @@ export const spyOn: typeof vitestSpyOn = (...args) => {
33
33
34
34
type Procedure = ( ...args : any [ ] ) => any ;
35
35
36
- // TODO: Remove in 9.0
37
- export type Mock < T extends Procedure | any [ ] = any [ ] , R = any > = T extends Procedure
38
- ? MockV2 < T >
39
- : T extends any [ ]
40
- ? MockV2 < ( ...args : T ) => R >
41
- : never ;
42
-
43
- // V2
44
36
export function fn < T extends Procedure = Procedure > ( implementation ?: T ) : Mock < T > ;
45
- // TODO: Remove in 9.0
46
- // V1
47
- export function fn < TArgs extends any [ ] = any , R = any > ( ) : Mock < ( ...args : TArgs ) => R > ;
48
- export function fn < TArgs extends any [ ] = any [ ] , R = any > (
49
- implementation : ( ...args : TArgs ) => R
50
- ) : Mock < ( ...args : TArgs ) => R > ;
51
- export function fn < TArgs extends any [ ] = any [ ] , R = any > (
52
- implementation ?: ( ...args : TArgs ) => R
53
- ) : Mock < ( ...args : TArgs ) => R > ;
54
37
export function fn ( implementation ?: Procedure ) {
55
38
const mock = implementation ? vitestFn ( implementation ) : vitestFn ( ) ;
56
39
return reactiveMock ( mock ) ;
Original file line number Diff line number Diff line change @@ -93,4 +93,4 @@ export const notFound = fn(actual.notFound).mockName('next/navigation::notFound'
93
93
interface Params {
94
94
[ key : string ] : string | string [ ] ;
95
95
}
96
- export const useParams = fn < [ ] , Params > ( actual . useParams ) . mockName ( 'next/navigation::useParams' ) ;
96
+ export const useParams = fn < ( ) => Params > ( actual . useParams ) . mockName ( 'next/navigation::useParams' ) ;
Original file line number Diff line number Diff line change @@ -93,4 +93,4 @@ export const notFound = fn(actual.notFound).mockName('next/navigation::notFound'
93
93
interface Params {
94
94
[ key : string ] : string | string [ ] ;
95
95
}
96
- export const useParams = fn < [ ] , Params > ( actual . useParams ) . mockName ( 'next/navigation::useParams' ) ;
96
+ export const useParams = fn < ( ) => Params > ( actual . useParams ) . mockName ( 'next/navigation::useParams' ) ;
You can’t perform that action at this time.
0 commit comments