type safe

This commit is contained in:
Stephen Zhou 2025-12-27 00:55:27 +08:00
parent 8698d4f0e6
commit 5058339bf1
No known key found for this signature in database
7 changed files with 10 additions and 9 deletions

View File

@ -30,7 +30,7 @@ const Item = ({
if (!isValid) {
Toast.notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }) as string,
message: t(`varKeyError.${errorMessageKey}`, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }),
})
return false
}

View File

@ -56,7 +56,7 @@ const AddExtractParameter: FC<Props> = ({
if (!isValid) {
Toast.notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, { ns: 'appDebug', key: errorKey }) as string,
message: t(`varKeyError.${errorMessageKey}`, { ns: 'appDebug', key: errorKey }),
})
return
}

View File

@ -106,10 +106,10 @@ const useConfig = (id: string, payload: WebhookTriggerNodeType) => {
if (!isValid) {
Toast.notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, {
message: t(`varKeyError.${errorMessageKey}`, {
ns: 'appDebug',
key: t('variableConfig.varName', { ns: 'appDebug' }),
}) as string,
}),
})
return false
}

View File

@ -1,4 +1,5 @@
import type { Node, ValueSelector } from '@/app/components/workflow/types'
import type { I18nKeysByPrefix } from '@/types/i18n'
import {
memo,
useMemo,
@ -16,7 +17,7 @@ import { cn } from '@/utils/classnames'
type NodeVariableItemProps = {
node: Node
variable: ValueSelector
writeMode?: string
writeMode?: I18nKeysByPrefix<'workflow', 'nodes.assigner.operations.'>
showBorder?: boolean
className?: string
isException?: boolean
@ -120,7 +121,7 @@ const NodeVariableItem = ({
{VariableIcon}
{VariableName}
</div>
{writeMode && <Badge className="shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}` as any, { ns: 'workflow' }) as string} />}
{writeMode && <Badge className="shrink-0" text={t(`${i18nPrefix}.operations.${writeMode}`, { ns: 'workflow' }) as string} />}
</div>
)
}

View File

@ -96,7 +96,7 @@ const VarGroupItem: FC<Props> = ({
if (!isValid) {
Toast.notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, { ns: 'appDebug', key: errorKey }) as string,
message: t(`varKeyError.${errorMessageKey}`, { ns: 'appDebug', key: errorKey }),
})
return
}

View File

@ -127,7 +127,7 @@ const ChatVariableModal = ({
if (!isValid) {
notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }) as string,
message: t(`varKeyError.${errorMessageKey}`, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }),
})
return false
}

View File

@ -37,7 +37,7 @@ const VariableModal = ({
if (!isValid) {
notify({
type: 'error',
message: t(`varKeyError.${errorMessageKey}` as any, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }) as string,
message: t(`varKeyError.${errorMessageKey}`, { ns: 'appDebug', key: t('env.modal.name', { ns: 'workflow' }) }),
})
return false
}