Skip to content

Commit 7c04169

Browse files
fix: remove JsonResponse from server function response (#5341)
1 parent 4b0004c commit 7c04169

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

packages/start-client-core/src/createServerFn.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type {
1616
ValidateSerializableInput,
1717
Validator,
1818
} from '@tanstack/router-core'
19-
import type { JsonResponse } from '@tanstack/router-core/ssr/client'
2019
import type {
2120
AnyFunctionMiddleware,
2221
AnyRequestMiddleware,
@@ -263,14 +262,14 @@ export interface OptionalFetcher<TMiddlewares, TInputValidator, TResponse>
263262
extends FetcherBase {
264263
(
265264
options?: OptionalFetcherDataOptions<TMiddlewares, TInputValidator>,
266-
): Promise<FetcherData<TResponse>>
265+
): Promise<Awaited<TResponse>>
267266
}
268267

269268
export interface RequiredFetcher<TMiddlewares, TInputValidator, TResponse>
270269
extends FetcherBase {
271270
(
272271
opts: RequiredFetcherDataOptions<TMiddlewares, TInputValidator>,
273-
): Promise<FetcherData<TResponse>>
272+
): Promise<Awaited<TResponse>>
274273
}
275274

276275
export type FetcherBaseOptions = {
@@ -294,13 +293,6 @@ export type RscStream<T> = {
294293

295294
export type Method = 'GET' | 'POST'
296295

297-
export type FetcherData<TResponse> =
298-
Awaited<TResponse> extends Response
299-
? Awaited<TResponse>
300-
: Awaited<TResponse> extends JsonResponse<any>
301-
? ReturnType<Awaited<TResponse>['json']>
302-
: Awaited<TResponse>
303-
304296
export type ServerFnReturnType<TRegister, TResponse> =
305297
Awaited<TResponse> extends Response
306298
? TResponse

packages/start-client-core/src/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export type {
6060
CompiledFetcherFn,
6161
Fetcher,
6262
RscStream,
63-
FetcherData,
6463
FetcherBaseOptions,
6564
ServerFn,
6665
ServerFnCtx,

0 commit comments

Comments
 (0)