@@ -9,9 +9,7 @@ import type {
9
9
Constrain ,
10
10
Expand ,
11
11
Register ,
12
- RegisteredSerializableInput ,
13
12
ResolveValidatorInput ,
14
- ValidateSerializable ,
15
13
ValidateSerializableInput ,
16
14
ValidateSerializableInputResult ,
17
15
Validator ,
@@ -330,8 +328,12 @@ export interface FullFetcherData<
330
328
context : AssignAllClientSendContext < TMiddlewares >
331
329
}
332
330
333
- export type FetcherData < TRegister extends Register , TResponse > =
334
- TResponse extends JsonResponse < any >
331
+ export type FetcherData <
332
+ TRegister extends Register ,
333
+ TResponse ,
334
+ > = TResponse extends Response
335
+ ? Response
336
+ : TResponse extends JsonResponse < any >
335
337
? ValidateSerializableInputResult < TRegister , ReturnType < TResponse [ 'json' ] > >
336
338
: ValidateSerializableInputResult < TRegister , TResponse >
337
339
@@ -351,9 +353,11 @@ export type ServerFnReturnType<
351
353
TResponse ,
352
354
> = TServerFnResponseType extends 'raw'
353
355
? RawResponse | Promise < RawResponse >
354
- :
355
- | Promise < ValidateSerializableInput < TRegister , TResponse > >
356
- | ValidateSerializableInput < TRegister , TResponse >
356
+ : TResponse extends Response
357
+ ? TResponse
358
+ :
359
+ | Promise < ValidateSerializableInput < TRegister , TResponse > >
360
+ | ValidateSerializableInput < TRegister , TResponse >
357
361
358
362
export type ServerFn <
359
363
TRegister extends Register ,
@@ -416,13 +420,10 @@ export type ServerFnBaseOptions<
416
420
functionId : string
417
421
}
418
422
419
- export type ValidateValidatorInput <
420
- TRegister extends Register ,
421
- TValidator ,
422
- > = ValidateSerializable <
423
- ResolveValidatorInput < TValidator > ,
424
- RegisteredSerializableInput < TRegister > | FormData
425
- >
423
+ export type ValidateValidatorInput < TRegister extends Register , TValidator > =
424
+ ResolveValidatorInput < TValidator > extends FormData
425
+ ? ResolveValidatorInput < TValidator >
426
+ : ValidateSerializableInput < TRegister , ResolveValidatorInput < TValidator > >
426
427
427
428
export type ValidateValidator < TRegister extends Register , TValidator > =
428
429
ValidateValidatorInput < TRegister , TValidator > extends infer TInput
0 commit comments