@@ -4,7 +4,6 @@ import type { ANY_MIDDLEWARE, MapInputMiddleware, Middleware } from './middlewar
44import type { CreateProcedureClientRest , ProcedureClient } from './procedure-client'
55import type { Context , MergeContext } from './types'
66import { DecoratedContractProcedure } from '@orpc/contract'
7- import { createCallableObject } from '@orpc/shared'
87import { decorateMiddleware } from './middleware-decorated'
98import { Procedure } from './procedure'
109import { createProcedureClient } from './procedure-client'
@@ -150,20 +149,21 @@ export class DecoratedProcedure<
150149
151150 /**
152151 * Make this procedure callable (works like a function while still being a procedure).
153- * **Note**: this only takes effect when this method is called at the end of the chain.
154152 */
155153 callable < TClientContext > ( ...rest : CreateProcedureClientRest < TContext , TOutputSchema , THandlerOutput , TClientContext > ) :
156- & DecoratedProcedure < TContext , TExtraContext , TInputSchema , TOutputSchema , THandlerOutput , TErrorMap >
154+ & Procedure < TContext , TExtraContext , TInputSchema , TOutputSchema , THandlerOutput , TErrorMap >
157155 & ProcedureClient < TClientContext , TInputSchema , TOutputSchema , THandlerOutput , TErrorMap > {
158- return createCallableObject ( this , createProcedureClient ( this , ...rest ) )
156+ return Object . assign ( createProcedureClient ( this , ...rest ) , {
157+ '~type' : 'Procedure' as const ,
158+ '~orpc' : this [ '~orpc' ] ,
159+ } )
159160 }
160161
161162 /**
162163 * Make this procedure compatible with server action (the same as .callable, but the type is compatible with server action).
163- * **Note**: this only takes effect when this method is called at the end of the chain.
164164 */
165165 actionable < TClientContext > ( ...rest : CreateProcedureClientRest < TContext , TOutputSchema , THandlerOutput , TClientContext > ) :
166- & DecoratedProcedure < TContext , TExtraContext , TInputSchema , TOutputSchema , THandlerOutput , TErrorMap >
166+ & Procedure < TContext , TExtraContext , TInputSchema , TOutputSchema , THandlerOutput , TErrorMap >
167167 & ( ( ...rest : ClientRest < TClientContext , SchemaInput < TInputSchema > > ) => Promise < SchemaOutput < TOutputSchema , THandlerOutput > > ) {
168168 return this . callable ( ...rest )
169169 }
0 commit comments