Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Fix type errors in completions code #9439

Merged
merged 3 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions packages/editor-ui/src/composables/useWorkflowHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import type { useRouter } from 'vue-router';
import { useTelemetry } from '@/composables/useTelemetry';
import { useProjectsStore } from '@/features/projects/projects.store';

export function resolveParameter(
export function resolveParameter<T = IDataObject>(
elsmr marked this conversation as resolved.
Show resolved Hide resolved
parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[],
opts: {
targetItem?: TargetItem;
Expand All @@ -79,7 +79,7 @@ export function resolveParameter(
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
isForCredential?: boolean;
} = {},
): IDataObject | null {
): T | null {
let itemIndex = opts?.targetItem?.itemIndex || 0;

const workflow = getCurrentWorkflow();
Expand Down Expand Up @@ -115,7 +115,7 @@ export function resolveParameter(
false,
undefined,
'',
) as IDataObject;
) as T;
elsmr marked this conversation as resolved.
Show resolved Hide resolved
}

const inputName = NodeConnectionType.Main;
Expand Down Expand Up @@ -235,7 +235,7 @@ export function resolveParameter(
false,
{},
contextNode!.name,
) as IDataObject;
) as T;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we get rid of this type coercion instead?

}

export function resolveRequiredParameters(
Expand Down
Loading
Loading