Skip to content

Commit b65853e

Browse files
authored
fix(router-core): fix typing of search in remountDeps (#5362)
1 parent dd32620 commit b65853e

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

packages/router-core/src/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ export interface FilebaseRouteOptionsInterface<
987987
(
988988
opt: RemountDepsOptions<
989989
TId,
990-
FullSearchSchemaOption<TParentRoute, TSearchValidator>,
990+
ResolveFullSearchSchema<TParentRoute, TSearchValidator>,
991991
Expand<ResolveAllParamsFromParent<TParentRoute, TParams>>,
992992
TLoaderDeps
993993
>,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { describe, expectTypeOf, test } from 'vitest'
2+
import type { RemountDepsOptions } from '../src'
3+
4+
type SearchSchema = {
5+
testParam: string
6+
}
7+
8+
type TestRemountDepsOptions = RemountDepsOptions<'/test', SearchSchema, {}, {}>
9+
10+
describe('RemountDepsOptions type test', () => {
11+
test('search field should be directly accessible', () => {
12+
expectTypeOf<
13+
TestRemountDepsOptions['search']
14+
>().toEqualTypeOf<SearchSchema>()
15+
})
16+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { describe, expect, test } from 'vitest'
2+
import type { RemountDepsOptions } from '../src'
3+
4+
describe('RemountDepsOptions unit tests', () => {
5+
test('search field should be directly accessible', () => {
6+
type SearchSchema = {
7+
testParam: string
8+
}
9+
10+
const mockOptions: RemountDepsOptions<'/test', SearchSchema, {}, {}> = {
11+
routeId: '/test',
12+
search: {
13+
testParam: 'test-value',
14+
},
15+
params: {},
16+
loaderDeps: {},
17+
}
18+
19+
expect(mockOptions.search.testParam).toBe('test-value')
20+
})
21+
})

0 commit comments

Comments
 (0)