Skip to content

Commit ba4738b

Browse files
committed
fix(workflows): fix VariableType assignment in admin workflow import route
The intermediate Record cast used 'string' for the type field which TypeScript correctly rejected — WorkflowVariable.type is 'VariableType', not string. Changed the cast to use VariableType so both branches typecheck correctly.
1 parent 2d86b7b commit ba4738b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • apps/sim/app/api/v1/admin/workflows/import

apps/sim/app/api/v1/admin/workflows/import/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
} from '@/app/api/v1/admin/responses'
3535
import {
3636
extractWorkflowMetadata,
37+
type VariableType,
3738
type WorkflowImportRequest,
3839
type WorkflowVariable,
3940
} from '@/app/api/v1/admin/types'
@@ -126,14 +127,14 @@ export const POST = withRouteHandler(
126127
const variablesRecord: Record<string, WorkflowVariable> = {}
127128
const vars = workflowData.variables as Record<
128129
string,
129-
{ id?: string; name: string; type?: string; value: unknown }
130+
{ id?: string; name: string; type?: VariableType; value: unknown }
130131
>
131132
Object.entries(vars).forEach(([key, v]) => {
132133
const varId = v.id || key
133134
variablesRecord[varId] = {
134135
id: varId,
135136
name: v.name,
136-
type: v.type || 'string',
137+
type: v.type ?? 'string',
137138
value: v.value,
138139
}
139140
})
@@ -149,7 +150,7 @@ export const POST = withRouteHandler(
149150
variablesRecord[varId] = {
150151
id: varId,
151152
name: v.name,
152-
type: v.type || 'string',
153+
type: (v.type as VariableType) ?? 'string',
153154
value: v.value,
154155
}
155156
})

0 commit comments

Comments
 (0)