Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions packages/start-client-core/src/createServerFn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type {
ValidateSerializableInput,
Validator,
} from '@tanstack/router-core'
import type { JsonResponse } from '@tanstack/router-core/ssr/client'
import type {
AnyFunctionMiddleware,
AnyRequestMiddleware,
Expand Down Expand Up @@ -263,14 +262,14 @@ export interface OptionalFetcher<TMiddlewares, TInputValidator, TResponse>
extends FetcherBase {
(
options?: OptionalFetcherDataOptions<TMiddlewares, TInputValidator>,
): Promise<FetcherData<TResponse>>
): Promise<Awaited<TResponse>>
}

export interface RequiredFetcher<TMiddlewares, TInputValidator, TResponse>
extends FetcherBase {
(
opts: RequiredFetcherDataOptions<TMiddlewares, TInputValidator>,
): Promise<FetcherData<TResponse>>
): Promise<Awaited<TResponse>>
}

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

export type Method = 'GET' | 'POST'

export type FetcherData<TResponse> =
Awaited<TResponse> extends Response
? Awaited<TResponse>
: Awaited<TResponse> extends JsonResponse<any>
? ReturnType<Awaited<TResponse>['json']>
: Awaited<TResponse>

export type ServerFnReturnType<TRegister, TResponse> =
Awaited<TResponse> extends Response
? TResponse
Expand Down
1 change: 0 additions & 1 deletion packages/start-client-core/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export type {
CompiledFetcherFn,
Fetcher,
RscStream,
FetcherData,
FetcherBaseOptions,
ServerFn,
ServerFnCtx,
Expand Down
Loading