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
22 changes: 11 additions & 11 deletions packages/start-client-core/src/createMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface FunctionMiddlewareWithTypes<
TClientContext,
TClientSendContext,
> {
_types: FunctionMiddlewareTypes<
'~types': FunctionMiddlewareTypes<
TRegister,
TMiddlewares,
TInputValidator,
Expand Down Expand Up @@ -187,9 +187,9 @@ export type IntersectAllValidatorInputs<TMiddlewares, TInputValidator> =
export type IntersectAllMiddleware<
TMiddlewares,
TType extends
| keyof AnyFunctionMiddleware['_types']
| keyof AnyRequestMiddleware['_types']
| keyof AnyServerFn['_types'],
| keyof AnyFunctionMiddleware['~types']
| keyof AnyRequestMiddleware['~types']
| keyof AnyServerFn['~types'],
TAcc = undefined,
> = TMiddlewares extends readonly [infer TMiddleware, ...infer TRest]
? TMiddleware extends
Expand All @@ -201,7 +201,7 @@ export type IntersectAllMiddleware<
TType,
IntersectAssign<
TAcc,
TMiddleware['_types'][TType & keyof TMiddleware['_types']]
TMiddleware['~types'][TType & keyof TMiddleware['~types']]
>
>
: TAcc
Expand Down Expand Up @@ -246,9 +246,9 @@ export type AssignAllClientContextBeforeNext<
export type AssignAllMiddleware<
TMiddlewares,
TType extends
| keyof AnyFunctionMiddleware['_types']
| keyof AnyRequestMiddleware['_types']
| keyof AnyServerFn['_types'],
| keyof AnyFunctionMiddleware['~types']
| keyof AnyRequestMiddleware['~types']
| keyof AnyServerFn['~types'],
TAcc = undefined,
> = TMiddlewares extends readonly [infer TMiddleware, ...infer TRest]
? TMiddleware extends
Expand All @@ -258,7 +258,7 @@ export type AssignAllMiddleware<
? AssignAllMiddleware<
TRest,
TType,
Assign<TAcc, TMiddleware['_types'][TType & keyof TMiddleware['_types']]>
Assign<TAcc, TMiddleware['~types'][TType & keyof TMiddleware['~types']]>
>
: TAcc
: TAcc
Expand Down Expand Up @@ -480,7 +480,7 @@ export type FunctionServerResultWithContext<
in out TSendContext,
> = {
'use functions must return the result of next()': true
_types: {
'~types': {
context: TServerContext
sendContext: TSendContext
}
Expand Down Expand Up @@ -703,7 +703,7 @@ export interface RequestMiddlewareWithTypes<
TMiddlewares,
TServerContext,
> {
_types: RequestMiddlewareTypes<TRegister, TMiddlewares, TServerContext>
'~types': RequestMiddlewareTypes<TRegister, TMiddlewares, TServerContext>
options: RequestMiddlewareOptions<TRegister, TMiddlewares, TServerContext>
}

Expand Down
4 changes: 2 additions & 2 deletions packages/start-client-core/src/createServerFn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ export interface ServerFnWithTypes<
in out TInputValidator,
in out TResponse,
> {
_types: ServerFnTypes<
'~types': ServerFnTypes<
TRegister,
TMethod,
TMiddlewares,
Expand Down Expand Up @@ -690,7 +690,7 @@ function serverFnBaseToMiddleware(
options: ServerFnBaseOptions<any, any, any, any, any>,
): AnyFunctionMiddleware {
return {
_types: undefined!,
'~types': undefined!,
options: {
inputValidator: options.inputValidator,
client: async ({ next, sendContext, ...ctx }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test('createMiddleware merges server context', () => {

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
a: boolean
}
Expand All @@ -80,7 +80,7 @@ test('createMiddleware merges server context', () => {

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
b: string
}
Expand All @@ -103,7 +103,7 @@ test('createMiddleware merges server context', () => {

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
c: number
}
Expand All @@ -129,7 +129,7 @@ test('createMiddleware merges server context', () => {

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
d: number
}
Expand Down Expand Up @@ -236,7 +236,7 @@ test('createMiddleware merges client context and sends to the server', () => {

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
e: string
}
Expand Down Expand Up @@ -314,7 +314,7 @@ test('createMiddleware merges server context and client context, sends server co

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
fromServer1: string
}
Expand Down Expand Up @@ -353,7 +353,7 @@ test('createMiddleware merges server context and client context, sends server co

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
fromServer2: string
}
Expand Down Expand Up @@ -403,7 +403,7 @@ test('createMiddleware merges server context and client context, sends server co

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
fromServer3: string
}
Expand Down Expand Up @@ -463,7 +463,7 @@ test('createMiddleware merges server context and client context, sends server co

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
fromServer4: string
}
Expand Down Expand Up @@ -532,7 +532,7 @@ test('createMiddleware merges server context and client context, sends server co

expectTypeOf(result).toEqualTypeOf<{
'use functions must return the result of next()': true
_types: {
'~types': {
context: {
fromServer5: string
}
Expand Down
Loading