@storybook/tanstack-react 10.6.0-alpha.0 → 10.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,147 +1,145 @@
1
- import * as _tanstack_react_router from '@tanstack/react-router';
2
- import { useNavigate as useNavigate$1, useRouter as useRouter$1, useBlocker as useBlocker$1, useSearch as useSearch$1, useParams as useParams$1, useLocation as useLocation$1, useRouterState as useRouterState$1, useLoaderData as useLoaderData$1, useLoaderDeps as useLoaderDeps$1, useRouteContext as useRouteContext$1, useCanGoBack as useCanGoBack$1, useLinkProps as useLinkProps$1, Navigate as Navigate$1 } from '@tanstack/react-router';
3
- export * from '@tanstack/react-router';
4
- import * as _tanstack_router_core from '@tanstack/router-core';
5
- import React from 'react';
1
+ import React from "react";
2
+ import { Navigate as Navigate$1, useBlocker as useBlocker$1, useCanGoBack as useCanGoBack$1, useLinkProps as useLinkProps$1, useLoaderData as useLoaderData$1, useLoaderDeps as useLoaderDeps$1, useLocation as useLocation$1, useNavigate as useNavigate$1, useParams as useParams$1, useRouteContext as useRouteContext$1, useRouter as useRouter$1, useRouterState as useRouterState$1, useSearch as useSearch$1 } from "@tanstack/react-router";
3
+ export * from "@tanstack/react-router";
6
4
 
5
+ //#region node_modules/@vitest/spy/dist/index.d.ts
7
6
  interface MockResultReturn<T> {
8
- type: "return";
9
- /**
10
- * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
11
- */
12
- value: T;
7
+ type: "return";
8
+ /**
9
+ * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
10
+ */
11
+ value: T;
13
12
  }
14
13
  interface MockResultIncomplete {
15
- type: "incomplete";
16
- value: undefined;
14
+ type: "incomplete";
15
+ value: undefined;
17
16
  }
18
17
  interface MockResultThrow {
19
- type: "throw";
20
- /**
21
- * An error that was thrown during function execution.
22
- */
23
- value: any;
18
+ type: "throw";
19
+ /**
20
+ * An error that was thrown during function execution.
21
+ */
22
+ value: any;
24
23
  }
25
24
  interface MockSettledResultFulfilled<T> {
26
- type: "fulfilled";
27
- value: T;
25
+ type: "fulfilled";
26
+ value: T;
28
27
  }
29
28
  interface MockSettledResultRejected {
30
- type: "rejected";
31
- value: any;
29
+ type: "rejected";
30
+ value: any;
32
31
  }
33
32
  type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;
34
33
  type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;
35
34
  interface MockContext<T extends Procedure> {
36
- /**
37
- * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
38
- *
39
- * @see https://vitest.dev/api/mock#mock-calls
40
- * @example
41
- * const fn = vi.fn()
42
- *
43
- * fn('arg1', 'arg2')
44
- * fn('arg3')
45
- *
46
- * fn.mock.calls === [
47
- * ['arg1', 'arg2'], // first call
48
- * ['arg3'], // second call
49
- * ]
50
- */
51
- calls: Parameters<T>[];
52
- /**
53
- * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
54
- * @see https://vitest.dev/api/mock#mock-instances
55
- */
56
- instances: ReturnType<T>[];
57
- /**
58
- * An array of `this` values that were used during each call to the mock function.
59
- * @see https://vitest.dev/api/mock#mock-contexts
60
- */
61
- contexts: ThisParameterType<T>[];
62
- /**
63
- * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
64
- *
65
- * @see https://vitest.dev/api/mock#mock-invocationcallorder
66
- * @example
67
- * const fn1 = vi.fn()
68
- * const fn2 = vi.fn()
69
- *
70
- * fn1()
71
- * fn2()
72
- * fn1()
73
- *
74
- * fn1.mock.invocationCallOrder === [1, 3]
75
- * fn2.mock.invocationCallOrder === [2]
76
- */
77
- invocationCallOrder: number[];
78
- /**
79
- * This is an array containing all values that were `returned` from the function.
80
- *
81
- * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
82
- *
83
- * @see https://vitest.dev/api/mock#mock-results
84
- * @example
85
- * const fn = vi.fn()
86
- * .mockReturnValueOnce('result')
87
- * .mockImplementationOnce(() => { throw new Error('thrown error') })
88
- *
89
- * const result = fn()
90
- *
91
- * try {
92
- * fn()
93
- * }
94
- * catch {}
95
- *
96
- * fn.mock.results === [
97
- * {
98
- * type: 'return',
99
- * value: 'result',
100
- * },
101
- * {
102
- * type: 'throw',
103
- * value: Error,
104
- * },
105
- * ]
106
- */
107
- results: MockResult<ReturnType<T>>[];
108
- /**
109
- * An array containing all values that were `resolved` or `rejected` from the function.
110
- *
111
- * This array will be empty if the function was never resolved or rejected.
112
- *
113
- * @see https://vitest.dev/api/mock#mock-settledresults
114
- * @example
115
- * const fn = vi.fn().mockResolvedValueOnce('result')
116
- *
117
- * const result = fn()
118
- *
119
- * fn.mock.settledResults === []
120
- * fn.mock.results === [
121
- * {
122
- * type: 'return',
123
- * value: Promise<'result'>,
124
- * },
125
- * ]
126
- *
127
- * await result
128
- *
129
- * fn.mock.settledResults === [
130
- * {
131
- * type: 'fulfilled',
132
- * value: 'result',
133
- * },
134
- * ]
135
- */
136
- settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
137
- /**
138
- * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
139
- * @see https://vitest.dev/api/mock#mock-lastcall
140
- */
141
- lastCall: Parameters<T> | undefined;
35
+ /**
36
+ * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
37
+ *
38
+ * @see https://vitest.dev/api/mock#mock-calls
39
+ * @example
40
+ * const fn = vi.fn()
41
+ *
42
+ * fn('arg1', 'arg2')
43
+ * fn('arg3')
44
+ *
45
+ * fn.mock.calls === [
46
+ * ['arg1', 'arg2'], // first call
47
+ * ['arg3'], // second call
48
+ * ]
49
+ */
50
+ calls: Parameters<T>[];
51
+ /**
52
+ * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
53
+ * @see https://vitest.dev/api/mock#mock-instances
54
+ */
55
+ instances: ReturnType<T>[];
56
+ /**
57
+ * An array of `this` values that were used during each call to the mock function.
58
+ * @see https://vitest.dev/api/mock#mock-contexts
59
+ */
60
+ contexts: ThisParameterType<T>[];
61
+ /**
62
+ * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
63
+ *
64
+ * @see https://vitest.dev/api/mock#mock-invocationcallorder
65
+ * @example
66
+ * const fn1 = vi.fn()
67
+ * const fn2 = vi.fn()
68
+ *
69
+ * fn1()
70
+ * fn2()
71
+ * fn1()
72
+ *
73
+ * fn1.mock.invocationCallOrder === [1, 3]
74
+ * fn2.mock.invocationCallOrder === [2]
75
+ */
76
+ invocationCallOrder: number[];
77
+ /**
78
+ * This is an array containing all values that were `returned` from the function.
79
+ *
80
+ * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
81
+ *
82
+ * @see https://vitest.dev/api/mock#mock-results
83
+ * @example
84
+ * const fn = vi.fn()
85
+ * .mockReturnValueOnce('result')
86
+ * .mockImplementationOnce(() => { throw new Error('thrown error') })
87
+ *
88
+ * const result = fn()
89
+ *
90
+ * try {
91
+ * fn()
92
+ * }
93
+ * catch {}
94
+ *
95
+ * fn.mock.results === [
96
+ * {
97
+ * type: 'return',
98
+ * value: 'result',
99
+ * },
100
+ * {
101
+ * type: 'throw',
102
+ * value: Error,
103
+ * },
104
+ * ]
105
+ */
106
+ results: MockResult<ReturnType<T>>[];
107
+ /**
108
+ * An array containing all values that were `resolved` or `rejected` from the function.
109
+ *
110
+ * This array will be empty if the function was never resolved or rejected.
111
+ *
112
+ * @see https://vitest.dev/api/mock#mock-settledresults
113
+ * @example
114
+ * const fn = vi.fn().mockResolvedValueOnce('result')
115
+ *
116
+ * const result = fn()
117
+ *
118
+ * fn.mock.settledResults === []
119
+ * fn.mock.results === [
120
+ * {
121
+ * type: 'return',
122
+ * value: Promise<'result'>,
123
+ * },
124
+ * ]
125
+ *
126
+ * await result
127
+ *
128
+ * fn.mock.settledResults === [
129
+ * {
130
+ * type: 'fulfilled',
131
+ * value: 'result',
132
+ * },
133
+ * ]
134
+ */
135
+ settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
136
+ /**
137
+ * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
138
+ * @see https://vitest.dev/api/mock#mock-lastcall
139
+ */
140
+ lastCall: Parameters<T> | undefined;
142
141
  }
143
- type Procedure = (...args: any[]) => any;
144
- // pick a single function type from function overloads, unions, etc...
142
+ type Procedure = (...args: any[]) => any; // pick a single function type from function overloads, unions, etc...
145
143
  type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
146
144
  /*
147
145
  cf. https://typescript-eslint.io/rules/method-signature-style/
@@ -156,163 +154,164 @@ const boolFn: Jest.Mock<() => boolean> = jest.fn<() => true>(() => true)
156
154
  */
157
155
  /* eslint-disable ts/method-signature-style */
158
156
  interface MockInstance<T extends Procedure = Procedure> extends Disposable {
159
- /**
160
- * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
161
- * @see https://vitest.dev/api/mock#getmockname
162
- */
163
- getMockName(): string;
164
- /**
165
- * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
166
- * @see https://vitest.dev/api/mock#mockname
167
- */
168
- mockName(name: string): this;
169
- /**
170
- * Current context of the mock. It stores information about all invocation calls, instances, and results.
171
- */
172
- mock: MockContext<T>;
173
- /**
174
- * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
175
- *
176
- * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
177
- * @see https://vitest.dev/api/mock#mockclear
178
- */
179
- mockClear(): this;
180
- /**
181
- * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
182
- *
183
- * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
184
- * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
185
- *
186
- * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
187
- * @see https://vitest.dev/api/mock#mockreset
188
- */
189
- mockReset(): this;
190
- /**
191
- * Does what `mockReset` does and restores original descriptors of spied-on objects.
192
- *
193
- * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
194
- * @see https://vitest.dev/api/mock#mockrestore
195
- */
196
- mockRestore(): void;
197
- /**
198
- * Returns current permanent mock implementation if there is one.
199
- *
200
- * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
201
- *
202
- * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
203
- */
204
- getMockImplementation(): NormalizedProcedure<T> | undefined;
205
- /**
206
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
207
- * @see https://vitest.dev/api/mock#mockimplementation
208
- * @example
209
- * const increment = vi.fn().mockImplementation(count => count + 1);
210
- * expect(increment(3)).toBe(4);
211
- */
212
- mockImplementation(fn: NormalizedProcedure<T>): this;
213
- /**
214
- * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
215
- *
216
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
217
- * @see https://vitest.dev/api/mock#mockimplementationonce
218
- * @example
219
- * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
220
- * expect(fn(3)).toBe(4);
221
- * expect(fn(3)).toBe(3);
222
- */
223
- mockImplementationOnce(fn: NormalizedProcedure<T>): this;
224
- /**
225
- * Overrides the original mock implementation temporarily while the callback is being executed.
226
- *
227
- * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
228
- * @see https://vitest.dev/api/mock#withimplementation
229
- * @example
230
- * const myMockFn = vi.fn(() => 'original')
231
- *
232
- * myMockFn.withImplementation(() => 'temp', () => {
233
- * myMockFn() // 'temp'
234
- * })
235
- *
236
- * myMockFn() // 'original'
237
- */
238
- withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
239
- /**
240
- * Use this if you need to return the `this` context from the method without invoking the actual implementation.
241
- * @see https://vitest.dev/api/mock#mockreturnthis
242
- */
243
- mockReturnThis(): this;
244
- /**
245
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
246
- * @see https://vitest.dev/api/mock#mockreturnvalue
247
- * @example
248
- * const mock = vi.fn()
249
- * mock.mockReturnValue(42)
250
- * mock() // 42
251
- * mock.mockReturnValue(43)
252
- * mock() // 43
253
- */
254
- mockReturnValue(value: ReturnType<T>): this;
255
- /**
256
- * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
257
- *
258
- * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
259
- * @example
260
- * const myMockFn = vi
261
- * .fn()
262
- * .mockReturnValue('default')
263
- * .mockReturnValueOnce('first call')
264
- * .mockReturnValueOnce('second call')
265
- *
266
- * // 'first call', 'second call', 'default'
267
- * console.log(myMockFn(), myMockFn(), myMockFn())
268
- */
269
- mockReturnValueOnce(value: ReturnType<T>): this;
270
- /**
271
- * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
272
- * @example
273
- * const asyncMock = vi.fn().mockResolvedValue(42)
274
- * asyncMock() // Promise<42>
275
- */
276
- mockResolvedValue(value: Awaited<ReturnType<T>>): this;
277
- /**
278
- * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
279
- * @example
280
- * const myMockFn = vi
281
- * .fn()
282
- * .mockResolvedValue('default')
283
- * .mockResolvedValueOnce('first call')
284
- * .mockResolvedValueOnce('second call')
285
- *
286
- * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
287
- * console.log(myMockFn(), myMockFn(), myMockFn())
288
- */
289
- mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
290
- /**
291
- * Accepts an error that will be rejected when async function is called.
292
- * @example
293
- * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
294
- * await asyncMock() // throws Error<'Async error'>
295
- */
296
- mockRejectedValue(error: unknown): this;
297
- /**
298
- * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
299
- * @example
300
- * const asyncMock = vi
301
- * .fn()
302
- * .mockResolvedValueOnce('first call')
303
- * .mockRejectedValueOnce(new Error('Async error'))
304
- *
305
- * await asyncMock() // first call
306
- * await asyncMock() // throws Error<'Async error'>
307
- */
308
- mockRejectedValueOnce(error: unknown): this;
157
+ /**
158
+ * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
159
+ * @see https://vitest.dev/api/mock#getmockname
160
+ */
161
+ getMockName(): string;
162
+ /**
163
+ * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
164
+ * @see https://vitest.dev/api/mock#mockname
165
+ */
166
+ mockName(name: string): this;
167
+ /**
168
+ * Current context of the mock. It stores information about all invocation calls, instances, and results.
169
+ */
170
+ mock: MockContext<T>;
171
+ /**
172
+ * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
173
+ *
174
+ * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
175
+ * @see https://vitest.dev/api/mock#mockclear
176
+ */
177
+ mockClear(): this;
178
+ /**
179
+ * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations.
180
+ *
181
+ * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`.
182
+ * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state.
183
+ *
184
+ * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
185
+ * @see https://vitest.dev/api/mock#mockreset
186
+ */
187
+ mockReset(): this;
188
+ /**
189
+ * Does what `mockReset` does and restores original descriptors of spied-on objects.
190
+ *
191
+ * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
192
+ * @see https://vitest.dev/api/mock#mockrestore
193
+ */
194
+ mockRestore(): void;
195
+ /**
196
+ * Returns current permanent mock implementation if there is one.
197
+ *
198
+ * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation.
199
+ *
200
+ * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided.
201
+ */
202
+ getMockImplementation(): NormalizedProcedure<T> | undefined;
203
+ /**
204
+ * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
205
+ * @see https://vitest.dev/api/mock#mockimplementation
206
+ * @example
207
+ * const increment = vi.fn().mockImplementation(count => count + 1);
208
+ * expect(increment(3)).toBe(4);
209
+ */
210
+ mockImplementation(fn: NormalizedProcedure<T>): this;
211
+ /**
212
+ * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
213
+ *
214
+ * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
215
+ * @see https://vitest.dev/api/mock#mockimplementationonce
216
+ * @example
217
+ * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
218
+ * expect(fn(3)).toBe(4);
219
+ * expect(fn(3)).toBe(3);
220
+ */
221
+ mockImplementationOnce(fn: NormalizedProcedure<T>): this;
222
+ /**
223
+ * Overrides the original mock implementation temporarily while the callback is being executed.
224
+ *
225
+ * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
226
+ * @see https://vitest.dev/api/mock#withimplementation
227
+ * @example
228
+ * const myMockFn = vi.fn(() => 'original')
229
+ *
230
+ * myMockFn.withImplementation(() => 'temp', () => {
231
+ * myMockFn() // 'temp'
232
+ * })
233
+ *
234
+ * myMockFn() // 'original'
235
+ */
236
+ withImplementation<T2>(fn: NormalizedProcedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
237
+ /**
238
+ * Use this if you need to return the `this` context from the method without invoking the actual implementation.
239
+ * @see https://vitest.dev/api/mock#mockreturnthis
240
+ */
241
+ mockReturnThis(): this;
242
+ /**
243
+ * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
244
+ * @see https://vitest.dev/api/mock#mockreturnvalue
245
+ * @example
246
+ * const mock = vi.fn()
247
+ * mock.mockReturnValue(42)
248
+ * mock() // 42
249
+ * mock.mockReturnValue(43)
250
+ * mock() // 43
251
+ */
252
+ mockReturnValue(value: ReturnType<T>): this;
253
+ /**
254
+ * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
255
+ *
256
+ * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
257
+ * @example
258
+ * const myMockFn = vi
259
+ * .fn()
260
+ * .mockReturnValue('default')
261
+ * .mockReturnValueOnce('first call')
262
+ * .mockReturnValueOnce('second call')
263
+ *
264
+ * // 'first call', 'second call', 'default'
265
+ * console.log(myMockFn(), myMockFn(), myMockFn())
266
+ */
267
+ mockReturnValueOnce(value: ReturnType<T>): this;
268
+ /**
269
+ * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
270
+ * @example
271
+ * const asyncMock = vi.fn().mockResolvedValue(42)
272
+ * asyncMock() // Promise<42>
273
+ */
274
+ mockResolvedValue(value: Awaited<ReturnType<T>>): this;
275
+ /**
276
+ * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
277
+ * @example
278
+ * const myMockFn = vi
279
+ * .fn()
280
+ * .mockResolvedValue('default')
281
+ * .mockResolvedValueOnce('first call')
282
+ * .mockResolvedValueOnce('second call')
283
+ *
284
+ * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
285
+ * console.log(myMockFn(), myMockFn(), myMockFn())
286
+ */
287
+ mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
288
+ /**
289
+ * Accepts an error that will be rejected when async function is called.
290
+ * @example
291
+ * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
292
+ * await asyncMock() // throws Error<'Async error'>
293
+ */
294
+ mockRejectedValue(error: unknown): this;
295
+ /**
296
+ * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
297
+ * @example
298
+ * const asyncMock = vi
299
+ * .fn()
300
+ * .mockResolvedValueOnce('first call')
301
+ * .mockRejectedValueOnce(new Error('Async error'))
302
+ *
303
+ * await asyncMock() // first call
304
+ * await asyncMock() // throws Error<'Async error'>
305
+ */
306
+ mockRejectedValueOnce(error: unknown): this;
309
307
  }
310
308
  /* eslint-enable ts/method-signature-style */
311
309
  interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
312
- new (...args: Parameters<T>): ReturnType<T>;
313
- (...args: Parameters<T>): ReturnType<T>;
310
+ new (...args: Parameters<T>): ReturnType<T>;
311
+ (...args: Parameters<T>): ReturnType<T>;
314
312
  }
315
-
313
+ //#endregion
314
+ //#region code/frameworks/tanstack-react/.dts-emit/code/frameworks/tanstack-react/src/export-mocks/react-router.d.ts
316
315
  declare const useNavigate: Mock<typeof useNavigate$1>;
317
316
  declare const useRouter: Mock<typeof useRouter$1>;
318
317
  declare const useBlocker: Mock<typeof useBlocker$1>;
@@ -326,18 +325,22 @@ declare const useRouteContext: Mock<typeof useRouteContext$1>;
326
325
  declare const useCanGoBack: Mock<typeof useCanGoBack$1>;
327
326
  declare const useLinkProps: Mock<typeof useLinkProps$1>;
328
327
  declare const Navigate: typeof Navigate$1;
329
- declare const Link: ({ to, children, ...props }: {
330
- to: string;
331
- children?: React.ReactNode;
332
- [key: string]: unknown;
328
+ declare const Link: ({
329
+ to,
330
+ children,
331
+ ...props
332
+ }: {
333
+ to: string;
334
+ children?: React.ReactNode;
335
+ [key: string]: unknown;
333
336
  }) => React.DetailedReactHTMLElement<{
334
- href: string;
335
- onClick: (e: React.MouseEvent) => void;
337
+ href: string;
338
+ onClick: (e: React.MouseEvent) => void;
336
339
  }, HTMLElement>;
337
340
  /**
338
341
  * Override createFileRoute from tanstack react router
339
342
  * because the org `createFileRoute` doesn't set the path in the Route
340
343
  */
341
- declare function createFileRoute(path: string): (options: any) => _tanstack_react_router.Route<unknown, _tanstack_router_core.AnyRoute, "/", "/" | `/${any}/`, string, "/" | `/${any}/`, undefined, _tanstack_router_core.ResolveParams<"/">, _tanstack_router_core.AnyContext, _tanstack_router_core.AnyContext, _tanstack_router_core.AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
342
-
343
- export { Link, Navigate, createFileRoute, useBlocker, useCanGoBack, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useNavigate, useParams, useRouteContext, useRouter, useRouterState, useSearch };
344
+ declare function createFileRoute(path: string): (options: any) => import("@tanstack/react-router").Route<unknown, import("@tanstack/router-core").AnyRoute, "/", "/" | `/${any}/`, string, "/" | `/${any}/`, undefined, import("@tanstack/router-core").ResolveParams<"/">, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, import("@tanstack/router-core").AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>;
345
+ //#endregion
346
+ export { Link, Navigate, createFileRoute, useBlocker, useCanGoBack, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useNavigate, useParams, useRouteContext, useRouter, useRouterState, useSearch };