From c959e6fc51167aa0ab343c8bd7e7871371fa7d6b Mon Sep 17 00:00:00 2001 From: newcat Date: Sat, 16 Mar 2024 18:48:42 +0100 Subject: [PATCH] Improve type inference --- packages/core/src/defineNode.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core/src/defineNode.ts b/packages/core/src/defineNode.ts index 786ee0ff..a1b4c27a 100644 --- a/packages/core/src/defineNode.ts +++ b/packages/core/src/defineNode.ts @@ -20,7 +20,7 @@ export interface INodeDefinition { outputs?: InterfaceFactory; /** This function is called by the engine with the input values. * It should perform the necessary calculation and then return the output values */ - calculate?: CalculateFunction; + calculate?: CalculateFunction, NoInfer>; /** Called as soon as an instance of the node is created but before it is placed into a graph */ onCreate?: (this: Node) => void; /** Called when the node is placed into a graph */ @@ -45,8 +45,8 @@ export function defineNode(definition: INodeDefinition): new () => N public calculate = definition.calculate ? (inputs: I, globalValues: any) => { - return definition.calculate!.call(this, inputs, globalValues); - } + return definition.calculate!.call(this, inputs, globalValues); + } : undefined; public onPlaced() {