Skip to content
Source
Sign inSign up
TanStack/router

fix: raw response handling #5276

Mergedschiller-manuel(GitHub profile, opens in a new tab)merged 6 commits intomain fromrefs/pull/5276/headmerged by schiller-manuel(GitHub profile, opens in a new tab)

Showing 9 changed files with 91 additions and 6 deletions (loading 6).

x
0 of 9 viewed, 9 left
38 additions and 0 deletionspackages/react-start-client/src/tests/createServerFn.test-d.tsxModified
View file
@@ -1,6 +1,8 @@
import { expectTypeOf, test } from 'vitest'
import { createServerFn } from '@tanstack/start-client-core'
​
+/*
+// disabled until we really support RSC
test.skip('createServerFn returns RSC', () => {
const fn = createServerFn().handler(() => ({
rscs: [
@@ -14,4 +16,40 @@
rscs: readonly [ReadableStream, ReadableStream]
}>
>()
+})*/
+​
+test('createServerFn returns async array', () => {
+ const result: Array<{ a: number }> = [{ a: 1 }]
+ const serverFn = createServerFn({ method: 'GET' }).handler(async () => {
+ return result
+ })
+​
+ expectTypeOf(serverFn()).toEqualTypeOf<Promise<Array<{ a: number }>>>()
})
+​
+test('createServerFn returns sync array', () => {
+ const result: Array<{ a: number }> = [{ a: 1 }]