Skip to content

Commit b54d056

Browse files
committed
"serialization rulez" second attempt
1 parent 9a4efc6 commit b54d056

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

packages/react-router/tests/router.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function validateSearchParams<
5959
}
6060

6161
function createTestRouter(
62-
options: RouterOptions<AnyRoute, 'never'> &
62+
options: RouterOptions<AnyRoute, 'never', any, any, any, any, any> &
6363
Required<Pick<RouterOptions<AnyRoute, 'never'>, 'history'>>,
6464
) {
6565
const rootRoute = createRootRoute({

packages/solid-router/tests/router.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export function validateSearchParams<
4747
expect(router.state.location.search).toEqual(expected)
4848
}
4949

50-
function createTestRouter(options?: RouterOptions<AnyRoute, 'never'>) {
50+
function createTestRouter(
51+
options?: RouterOptions<AnyRoute, 'never', any, any, any, any, any>,
52+
) {
5153
const rootRoute = createRootRoute({
5254
validateSearch: z.object({ root: z.string().optional() }),
5355
component: () => {

packages/start-client-core/src/serializer/ServerFunctionSerializationAdapter.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { TSS_SERVER_FUNCTION } from '../constants'
44

55
export const ServerFunctionSerializationAdapter = createSerializationAdapter({
66
key: '$TSS/serverfn',
7-
test: (v): v is { functionId: string } => v[TSS_SERVER_FUNCTION],
7+
test: (v): v is { functionId: string } => {
8+
if (typeof v !== 'object' || v === null) return false
9+
10+
if (!(TSS_SERVER_FUNCTION in v)) return false
11+
12+
return !!v[TSS_SERVER_FUNCTION]
13+
},
814
toSerializable: ({ functionId }) => ({ functionId }),
915
fromSerializable: ({ functionId }) => createClientRpc(functionId),
1016
})

packages/start-server-core/src/serializer/ServerFunctionSerializationAdapter.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ import { getServerFnById } from '../getServerFnById'
55

66
export const ServerFunctionSerializationAdapter = createSerializationAdapter({
77
key: '$TSS/serverfn',
8-
test: (v): v is { functionId: string } => v[TSS_SERVER_FUNCTION],
8+
test: (v): v is { functionId: string } => {
9+
if (typeof v !== 'object' || v === null) return false
10+
11+
if (!(TSS_SERVER_FUNCTION in v)) return false
12+
13+
return !!v[TSS_SERVER_FUNCTION]
14+
},
915
toSerializable: ({ functionId }) => ({ functionId }),
1016
fromSerializable: ({ functionId }) => {
1117
const fn = async (opts: any, signal: any): Promise<any> => {

0 commit comments

Comments
 (0)