@@ -41,9 +41,9 @@ export const clearCapturedCalls = () => {
4141export type UfcReturnType < T , O extends FlytrapCallOptions > = T extends AnyFunction
4242 ? ReturnType < T >
4343 : T extends object
44- ? // @ts -expect-error
45- ReturnType < T [ O [ 'name' ] ] >
46- : never
44+ ? // @ts -expect-error
45+ ReturnType < T [ O [ 'name' ] ] >
46+ : never
4747
4848export function ufc < T , O extends FlytrapCallOptions > (
4949 functionOrNamespace : T ,
@@ -287,22 +287,13 @@ function saveFunctionCall(opts: FlytrapCallOptions) {
287287}
288288
289289function saveOutputForFunctionCall < T > ( functionCallId : string , output : T ) {
290- // @ts -ignore for some reason this isn't included
291- // const functionCallIndex = _functionCalls.findLastIndex((call) => call.id === functionCallId)
292290 const functionCall = getFunctionCallById ( functionCallId )
293291
294- // console.log("function calls invocations length", _functionCalls.reduce((acc, curr) => acc + curr.invocations.length, 0))
295-
296292 if ( functionCall === undefined ) {
297293 log . error ( 'error' , `Saving output for nonexistent function call with ID "${ functionCallId } "` )
298294 return
299295 }
300296
301- /* if (functionCallIndex === -1) {
302- log.error('error', `Saving output for nonexistent function call with ID "${functionCallId}"`)
303- return
304- } */
305-
306297 const lastInvocation = functionCall . invocations . at ( - 1 )
307298 if ( lastInvocation ) lastInvocation . output = output
308299}
@@ -317,14 +308,6 @@ function saveOutputForFunction<T>(functionId: string, output: T) {
317308 return
318309 }
319310
320- /* if (functionIndex === -1) {
321- log.error('error', `Saving output for nonexistent function with ID "${functionId}"`)
322- return
323- } */
324-
325- // console.log("functions invocations length", _executingFunctions.reduce((acc, curr) => acc + curr.invocations.length, 0))
326-
327- // const lastInvocation = _executingFunctions[functionIndex].invocations.at(-1)
328311 const lastInvocation = functionDef . invocations . at ( - 1 )
329312 if ( lastInvocation ) lastInvocation . output = output
330313}
@@ -336,7 +319,6 @@ function getFunctionCallById(functionCallId: string) {
336319 }
337320 }
338321 return undefined
339- // return _functionCalls.find((call) => call.id === functionCallId)
340322}
341323
342324function getFunctionById ( functionId : string ) {
@@ -347,7 +329,6 @@ function getFunctionById(functionId: string) {
347329 }
348330
349331 return undefined
350- // return _executingFunctions.find((func) => func.id === functionId)
351332}
352333
353334// TODO: let's make overloaded calls like this for `capture`
0 commit comments