Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
refactor(web): remove unnecessary type assertions with a migration-only tsslint rule (#44219)
Stephen Zhou835f277338c4
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.jsonindex 8e9f1033d1f..af258a93719 100644--- a/oxlint-suppressions.json+++ b/oxlint-suppressions.json@@ -696,7 +696,7 @@"count": 2},"typescript/no-explicit-any": {- "count": 12+ "count": 10}},"web/app/components/base/chat/chat/question.tsx": {@@ -2177,7 +2177,7 @@},"web/app/components/rag-pipeline/hooks/use-pipeline-config.ts": {"typescript/no-explicit-any": {- "count": 4+ "count": 3}},"web/app/components/rag-pipeline/hooks/use-pipeline-run.ts": {@@ -2451,12 +2451,7 @@},"web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx": {"typescript/no-explicit-any": {- "count": 3- }- },- "web/app/components/workflow/hooks/use-helpline.ts": {- "typescript/no-explicit-any": {- "count": 1+ "count": 2}},"web/app/components/workflow/hooks/use-serial-async-callback.ts": {@@ -2679,7 +2674,7 @@},"web/app/components/workflow/nodes/_base/components/variable/utils.ts": {"typescript/no-explicit-any": {- "count": 31+ "count": 29}},"web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx": {@@ -3283,7 +3278,7 @@},"web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx": {"typescript/no-explicit-any": {- "count": 15+ "count": 14}},"web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsx": {@@ -3499,7 +3494,7 @@"count": 2},"typescript/no-explicit-any": {- "count": 8+ "count": 7}},"web/app/components/workflow/panel/debug-and-preview/user-input.tsx": {diff --git a/web/.storybook/preview.tsx b/web/.storybook/preview.tsxindex f91a9f14ba1..2cbbdbe7df3 100644--- a/web/.storybook/preview.tsx+++ b/web/.storybook/preview.tsx@@ -20,7 +20,7 @@ const storyResources: Resource = {'en-US': {// Preload the most common namespace to avoid missing keys during initial render;// other namespaces will be loaded on demand via resourcesToBackend.- common: commonEnUS as unknown as Record<string, unknown>,+ common: commonEnUS as Record<string, unknown>,},}diff --git a/web/.storybook/utils/audio-player-manager.mock.ts b/web/.storybook/utils/audio-player-manager.mock.tsindex aff5655fc6b..677973064b2 100644--- a/web/.storybook/utils/audio-player-manager.mock.ts+++ b/web/.storybook/utils/audio-player-manager.mock.ts@@ -49,7 +49,7 @@ class MockAudioPlayerManager {}export const ensureMockAudioManager = () => {- const managerAny = AudioPlayerManager as unknown as {+ const managerAny = AudioPlayerManager as {getInstance: () => AudioPlayerManager__isStorybookMockInstalled?: boolean}diff --git a/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx b/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsxindex 186b7dcf613..5623a2a37c6 100644--- a/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx+++ b/web/app/(shareLayout)/webapp-reset-password/set-password/__tests__/page.spec.tsx@@ -30,9 +30,7 @@ describe('Webapp Reset Password Set Password Page', () => {typeof useRouter>)vi.mocked(useSearchParams).mockReturnValue(- new URLSearchParams({ token: 'reset-token' }) as unknown as ReturnType<- typeof useSearchParams- >,+ new URLSearchParams({ token: 'reset-token' }) as ReturnType<typeof useSearchParams>,)vi.mocked(changeWebAppPasswordWithToken).mockResolvedValue({ result: 'success' })})diff --git a/web/app/components/__tests__/external-attribution-recorder.spec.tsx b/web/app/components/__tests__/external-attribution-recorder.spec.tsxindex dc788282baf..1f406b9cfde 100644--- a/web/app/components/__tests__/external-attribution-recorder.spec.tsx+++ b/web/app/components/__tests__/external-attribution-recorder.spec.tsx@@ -23,7 +23,7 @@ const mockUseSearchParams = vi.mocked(useSearchParams)const setSearchParams = (search = '') => {mockUseSearchParams.mockReturnValue(- new URLSearchParams(search) as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams(search) as ReturnType<typeof useSearchParams>,)}diff --git a/web/app/components/__tests__/oauth-registration-analytics.spec.tsx b/web/app/components/__tests__/oauth-registration-analytics.spec.tsxindex 4826dc91acc..ad96dc6ac1b 100644--- a/web/app/components/__tests__/oauth-registration-analytics.spec.tsx+++ b/web/app/components/__tests__/oauth-registration-analytics.spec.tsx@@ -51,7 +51,7 @@ const mockUseSearchParams = vi.mocked(useSearchParams)const setSearchParams = (searchParams = '') => {mockUseSearchParams.mockReturnValue(- new URLSearchParams(searchParams) as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams(searchParams) as ReturnType<typeof useSearchParams>,)window.history.replaceState(null, '', `/signin${searchParams ? `?${searchParams}` : ''}`)}diff --git a/web/app/components/app/configuration/config-var/config-modal/index.tsx b/web/app/components/app/configuration/config-var/config-modal/index.tsxindex 8950a222dd7..d0ace9e96e4 100644--- a/web/app/components/app/configuration/config-var/config-modal/index.tsx+++ b/web/app/components/app/configuration/config-var/config-modal/index.tsx@@ -3,7 +3,7 @@import type { ChangeEvent, FC } from 'react'import type { Item as SelectItem } from './type-select'import type { ConfigModalValidationError } from './utils'-import type { InputVar, InputVarType, MoreInfo } from '@/app/components/workflow/types'+import type { InputVar, MoreInfo } from '@/app/components/workflow/types'import { Dialog, DialogContent, DialogTitle } from '@langgenius/dify-ui/dialog'import { skipToken, useQuery, useQueryClient } from '@tanstack/react-query'import * as React from 'react'@@ -133,7 +133,7 @@ const ConfigModal: FC<IConfigModalProps> = ({)const handleTypeChange = useCallback((item: SelectItem) => {- setTempPayload((prev) => createPayloadForType(prev, item.value as InputVarType))+ setTempPayload((prev) => createPayloadForType(prev, item.value))setValidationError(undefined)}, [])diff --git a/web/app/components/app/configuration/config-var/index.tsx b/web/app/components/app/configuration/config-var/index.tsxindex 3782292cb22..66e8a8593ee 100644--- a/web/app/components/app/configuration/config-var/index.tsx+++ b/web/app/components/app/configuration/config-var/index.tsx@@ -78,7 +78,7 @@ const getDuplicateError = (list: PromptVariable[]) => {typeName: 'variableConfig.varName',} as const}- if (hasDuplicateStr(list.map((item) => item.name as string))) {+ if (hasDuplicateStr(list.map((item) => item.name))) {return {errorMsgKey: 'varKeyError.keyAlreadyExists',typeName: 'variableConfig.labelName',diff --git a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx b/web/app/components/app/configuration/config/agent/agent-tools/index.tsxindex 2dc637af297..c8e34760b69 100644--- a/web/app/components/app/configuration/config/agent/agent-tools/index.tsx+++ b/web/app/components/app/configuration/config/agent/agent-tools/index.tsx@@ -201,7 +201,7 @@ const AgentTools: FC = () => {supportAddCustomToolonSelect={handleSelectTool}onSelectMultiple={handleSelectMultipleTool}- selectedTools={tools as unknown as ToolValue[]}+ selectedTools={tools as ToolValue[]}/></>)}diff --git a/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx b/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsxindex 67724ec317d..68b4da276ad 100644--- a/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/card-item/__tests__/index.spec.tsx@@ -76,7 +76,7 @@ const createDataset = (overrides: Partial<DataSet> = {}): DataSet => {...createDatasetFixture(),id: 'dataset-id',name: 'Dataset Name',- icon_info: resolvedIconInfo as DataSet['icon_info'],+ icon_info: resolvedIconInfo,description: 'A test dataset',permission: DatasetPermission.onlyMe,data_source_type: DataSourceType.FILE,diff --git a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsxindex 0af86900ded..12ed1833510 100644--- a/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx+++ b/web/app/components/app/configuration/dataset-config/params-config/__tests__/config-content.spec.tsx@@ -98,7 +98,7 @@ const createDataset = (overrides: Partial<DataSet> = {}): DataSet => {...createDatasetFixture(),id: 'dataset-id',name: 'Dataset Name',- icon_info: resolvedIconInfo as DataSet['icon_info'],+ icon_info: resolvedIconInfo,description: 'A test dataset',permission: DatasetPermission.onlyMe,data_source_type: DataSourceType.FILE,diff --git a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsxindex e0be61c5725..e58b438f25b 100644--- a/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx+++ b/web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx@@ -141,7 +141,7 @@ const createModelConfig = (promptVariables: PromptVariableWithMeta[] = []): Modemode: ModelModeType.chat,configs: {prompt_template: '',- prompt_variables: promptVariables as unknown as PromptVariable[],+ prompt_variables: promptVariables as PromptVariable[],},chat_prompt_config: DEFAULT_CHAT_PROMPT_CONFIG,completion_prompt_config: DEFAULT_COMPLETION_PROMPT_CONFIG,diff --git a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsxindex 0a394b0b6fd..b9596a614df 100644--- a/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx+++ b/web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx@@ -735,7 +735,7 @@ describe('CreateFromDSLModal', () => {mockImportDSL.mockImplementationOnce(() =>new Promise((resolve) => {- resolveImport = resolve as typeof resolveImport+ resolveImport = resolve}),)const handleClose = vi.fn()@@ -792,7 +792,7 @@ describe('CreateFromDSLModal', () => {mockImportDSLConfirm.mockImplementationOnce(() =>new Promise((resolve) => {- resolveConfirm = resolve as typeof resolveConfirm+ resolveConfirm = resolve}),)diff --git a/web/app/components/app/deploy/shared/version-selection/__tests__/use-infinite-scroll.spec.ts b/web/app/components/app/deploy/shared/version-selection/__tests__/use-infinite-scroll.spec.tsindex fd61bacd0e3..d76e5c70849 100644--- a/web/app/components/app/deploy/shared/version-selection/__tests__/use-infinite-scroll.spec.ts+++ b/web/app/components/app/deploy/shared/version-selection/__tests__/use-infinite-scroll.spec.ts@@ -93,8 +93,7 @@ describe('deploy useInfiniteScroll', () => {intersectionOptions = undefinedscrollRoot = nullscrollSentinel = null- globalThis.IntersectionObserver =- MockIntersectionObserver as unknown as typeof IntersectionObserver+ globalThis.IntersectionObserver = MockIntersectionObserver})afterAll(() => {diff --git a/web/app/components/app/text-generate/item/index.tsx b/web/app/components/app/text-generate/item/index.tsxindex 6664d0371dd..5953aecf986 100644--- a/web/app/components/app/text-generate/item/index.tsx+++ b/web/app/components/app/text-generate/item/index.tsx@@ -139,7 +139,7 @@ const GenerationItem: FC<IGenerationItemProps> = ({return}startQuerying()- const res: any = await fetchMoreLikeThis(messageId as string, appSourceType, installedAppId)+ const res: any = await fetchMoreLikeThis(messageId, appSourceType, installedAppId)setCompletionRes(res.answer)setChildFeedback({rating: null,diff --git a/web/app/components/apps/hooks/__tests__/use-workflow-online-users.spec.ts b/web/app/components/apps/hooks/__tests__/use-workflow-online-users.spec.tsindex 3d776b11a58..78c596f7d64 100644--- a/web/app/components/apps/hooks/__tests__/use-workflow-online-users.spec.ts+++ b/web/app/components/apps/hooks/__tests__/use-workflow-online-users.spec.ts@@ -39,7 +39,7 @@ vi.mock('@/service/console', () => ({const getLastQueryOptions = () => {const lastCall = mockQueryOptions.mock.lastCallif (!lastCall) throw new Error('workflows.onlineUsers.post.queryOptions was not called')- return lastCall[0] as QueryOptions+ return lastCall[0]}describe('useWorkflowOnlineUsers', () => {diff --git a/web/app/components/base/agent-log-modal/index.stories.tsx b/web/app/components/base/agent-log-modal/index.stories.tsxindex 21c2779a261..80dfb397d3b 100644--- a/web/app/components/base/agent-log-modal/index.stories.tsx+++ b/web/app/components/base/agent-log-modal/index.stories.tsx@@ -86,7 +86,7 @@ const AgentLogModalDemo = ({ width = 960 }: { width?: number }) => {throw new Error(`Unhandled request: ${url}`)}- globalThis.fetch = handler as typeof globalThis.fetch+ globalThis.fetch = handlerreturn () => {if (originalFetchRef.current) globalThis.fetch = originalFetchRef.currentdiff --git a/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts b/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.tsindex 5441aece298..1ec3714f388 100644--- a/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts+++ b/web/app/components/base/audio-btn/__tests__/audio.player.manager.spec.ts@@ -30,7 +30,7 @@ const MockAudioPlayer = vi.hoisted(() => {constructor(...args: AudioPlayerCtorArgs) {mockAudioPlayerConstructor(...args)- mockState.instances.push(this as unknown as MockAudioPlayerInstance)+ mockState.instances.push(this)}}})diff --git a/web/app/components/base/audio-btn/__tests__/index.spec.tsx b/web/app/components/base/audio-btn/__tests__/index.spec.tsxindex a1ef1e74dc8..92d35288d39 100644--- a/web/app/components/base/audio-btn/__tests__/index.spec.tsx+++ b/web/app/components/base/audio-btn/__tests__/index.spec.tsx@@ -24,7 +24,7 @@ vi.mock('@/app/components/base/audio-btn/audio.player.manager', () => ({describe('AudioBtn', () => {const getButton = () => screen.getByRole('button')const mockUseParams = (value: Partial<Record<string, string>>) => {- vi.mocked(useParams).mockReturnValue(value as ReturnType<typeof useParams>)+ vi.mocked(useParams).mockReturnValue(value)}const mockUsePathname = (value: string) => {vi.mocked(usePathname).mockReturnValue(value)diff --git a/web/app/components/base/audio-btn/audio.ts b/web/app/components/base/audio-btn/audio.tsindex 3431ed90687..9d54d07862a 100644--- a/web/app/components/base/audio-btn/audio.ts+++ b/web/app/components/base/audio-btn/audio.ts@@ -252,7 +252,7 @@ export class AudioPlayer {private async loadAudio() {try {- const audioResponse = (await textToAudioStream(+ const audioResponse = await textToAudioStream(this.url,this.isPublic ? AppSourceType.webApp : AppSourceType.installedApp,{@@ -261,7 +261,7 @@ export class AudioPlayer {voice: this.voice,text: this.msgContent,},- )) as Response+ )if (this.destroyed) returnif (audioResponse.status !== 200) {this.failLoad()diff --git a/web/app/components/base/chat/__tests__/utils.spec.ts b/web/app/components/base/chat/__tests__/utils.spec.tsindex fb48fab69f2..a3137d54824 100644--- a/web/app/components/base/chat/__tests__/utils.spec.ts+++ b/web/app/components/base/chat/__tests__/utils.spec.ts@@ -541,7 +541,7 @@ describe('chat utils - url params and answer helpers', () => {it('getThreadMessages node without children', () => {const tree = [{ id: 'q1', isAnswer: false }]- const thread = getThreadMessages(tree as unknown as ChatItemInTree[], 'q1')+ const thread = getThreadMessages(tree as ChatItemInTree[], 'q1')expect(thread.length).toBe(1)expect(thread[0]!.id).toBe('q1')})@@ -554,7 +554,7 @@ describe('chat utils - url params and answer helpers', () => {it('getThreadMessages target not found with undefined children', () => {const tree = [{ id: 'q1', isAnswer: false }]- const thread = getThreadMessages(tree as unknown as ChatItemInTree[], 'missing')+ const thread = getThreadMessages(tree as ChatItemInTree[], 'missing')expect(thread.length).toBe(0)})diff --git a/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx b/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsxindex b5a994e6962..49ae7a00389 100644--- a/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx+++ b/web/app/components/base/chat/chat-with-history/__tests__/hooks.spec.tsx@@ -663,9 +663,7 @@ describe('useChatWithHistory', () => {mockFetchConversations.mockResolvedValue(createConversationData())mockFetchChatList.mockResolvedValue({ data: [] })// First call blocks, second call should be rejected by guard- mockDelConversation.mockReturnValueOnce(- deletePromise as unknown as ReturnType<typeof mockDelConversation>,- )+ mockDelConversation.mockReturnValueOnce(deletePromise)const onSuccess = vi.fn()const { result } = await renderWithClient(() => useChatWithHistory())@@ -773,9 +771,7 @@ describe('useChatWithHistory', () => {})mockFetchConversations.mockResolvedValue(createConversationData())mockFetchChatList.mockResolvedValue({ data: [] })- mockRenameConversation.mockReturnValueOnce(- renamePromise as unknown as ReturnType<typeof mockRenameConversation>,- )+ mockRenameConversation.mockReturnValueOnce(renamePromise)const onSuccess = vi.fn()const { result } = await renderWithClient(() => useChatWithHistory())diff --git a/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx b/web/app/components/base/chat/chat/__tests__/hooks.spec.tsxindex e37bcca4d93..249261dd458 100644--- a/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx+++ b/web/app/components/base/chat/chat/__tests__/hooks.spec.tsx@@ -76,7 +76,6 @@ type HookCallbacks = {data: { message_id?: string; reasoning: string; node_id?: string; is_final?: boolean }}) => void}-type UseChatFormSettings = NonNullable<Parameters<typeof useChat>[1]>describe('useChat', () => {beforeEach(() => {@@ -138,9 +137,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree))expect(result.current.chatList).toHaveLength(1)expect(result.current.chatList[0]!.content).toBe('Hello updated')})@@ -164,13 +161,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(- config as ChatConfig,- formSettings as UseChatFormSettings,- prevChatTree as ChatItemInTree[],- ),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, formSettings, prevChatTree))expect(result.current.chatList[0]!.content).toBe('Hello Bob')expect(result.current.chatList[0]!.suggestedQuestions).toEqual(['Ask Bob'])@@ -234,10 +225,9 @@ describe('useChat', () => {suggested_questions: ['Ask about {{name}}'],}- const { result, rerender } = renderHook(- ({ fs }) => useChat(config as ChatConfig, fs as UseChatFormSettings),- { initialProps: { fs: { inputs: { name: 'Alice' }, inputsForm: [] } } },- )+ const { result, rerender } = renderHook(({ fs }) => useChat(config as ChatConfig, fs), {+ initialProps: { fs: { inputs: { name: 'Alice' }, inputsForm: [] } },+ })const openerBefore = result.current.chatList[0]expect(openerBefore!.content).toBe('Hello Alice')@@ -254,10 +244,9 @@ describe('useChat', () => {suggested_questions: ['Ask {{name}}'],}- const { result, rerender } = renderHook(- ({ fs }) => useChat(config as ChatConfig, fs as UseChatFormSettings),- { initialProps: { fs: { inputs: { name: 'Alice' }, inputsForm: [] } } },- )+ const { result, rerender } = renderHook(({ fs }) => useChat(config as ChatConfig, fs), {+ initialProps: { fs: { inputs: { name: 'Alice' }, inputsForm: [] } },+ })const before = result.current.chatList[0]@@ -289,9 +278,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree))const openerBefore = result.current.chatList[0]expect(openerBefore!.content).toBe('Hello updated')@@ -1202,9 +1189,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleSend(@@ -1486,9 +1471,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-1', 'wr-1', { isPublicAPI: true, onNotifyError })@@ -1749,9 +1732,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-2', 'wr-1', { isPublicAPI: true })@@ -1790,9 +1771,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree))act(() => {result.current.handleResume('m-resume-error', 'wr-error', {@@ -1833,9 +1812,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-resume-error', 'wr-error', {@@ -1876,9 +1853,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))const previousWorkflowAbort = createAbortControllerMock()act(() => {@@ -1916,9 +1891,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-guard', 'wr-1', { isPublicAPI: true })@@ -1966,9 +1939,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree))act(() => {result.current.handleResume('m-suggest-resume', 'wr-1', {@@ -2015,9 +1986,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-human-resume', 'wr-1', { isPublicAPI: true })@@ -2329,9 +2298,7 @@ describe('useChat', () => {children: [{ id: 'm-1', content: '', isAnswer: true, siblingIndex: 0 }],},]- const { result, unmount } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result, unmount } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-1', 'wr-1', { isPublicAPI: true })@@ -2489,9 +2456,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, nestedTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, nestedTree))act(() => {result.current.handleSwitchSibling('a-deep', { isPublicAPI: true })})@@ -3066,9 +3031,7 @@ describe('useChat', () => {]// Render the chat with the nested tree- const { result } = renderHook(() =>- useChat(undefined, undefined, nestedTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, nestedTree))// Setting TargetNodeId triggers state update using produceChatTreeNode internallyact(() => {@@ -3111,9 +3074,7 @@ describe('useChat', () => {],},]- const { result: resumeResult } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result: resumeResult } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {resumeResult.current.handleResume('m-resume', 'wr-1', { isPublicAPI: true })})@@ -3236,9 +3197,7 @@ describe('useChat', () => {],},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-data', 'wr-1', { isPublicAPI: true })})@@ -3297,9 +3256,7 @@ describe('useChat', () => {],},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-index', 'wr-1', { isPublicAPI: true })})@@ -3476,9 +3433,7 @@ describe('useChat', () => {]// Success branch- const { result } = renderHook(() =>- useChat(config as ChatConfig, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(config as ChatConfig, undefined, prevChatTree))act(() => {result.current.handleResume('m-1', 'wr-1', { isPublicAPI: true, onGetSuggestedQuestions })})@@ -3632,9 +3587,7 @@ describe('useChat', () => {children: [{ id: 'a-1', content: 'a', isAnswer: true, siblingIndex: 0 }],},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))await act(async () => {// (annotationId, authorName, query, answer, index)result.current.handleAnnotationAdded('anno-id', 'author', 'q-new', 'a-new', 1)@@ -3654,9 +3607,7 @@ describe('useChat', () => {children: [{ id: 'a-1', content: 'a', isAnswer: true, siblingIndex: 0 }],},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))await act(async () => {// (query, answer, index)result.current.handleAnnotationEdited('q-edit', 'a-edit', 1)@@ -3778,9 +3729,7 @@ describe('useChat', () => {},]- const { result } = renderHook(() =>- useChat(undefined, undefined, prevChatTree as ChatItemInTree[]),- )+ const { result } = renderHook(() => useChat(undefined, undefined, prevChatTree))act(() => {result.current.handleResume('m-1', 'wr-1', { isPublicAPI: true })diff --git a/web/app/components/base/chat/chat/answer/human-input-content/utils.ts b/web/app/components/base/chat/chat/answer/human-input-content/utils.tsindex d80fd04ddc2..74e55aa77c9 100644--- a/web/app/components/base/chat/chat/answer/human-input-content/utils.ts+++ b/web/app/components/base/chat/chat/answer/human-input-content/utils.ts@@ -1,6 +1,5 @@import type { ButtonProps } from '@langgenius/dify-ui/button'import type { HumanInputFieldValue } from './field-renderer'-import type { FileEntity } from '@/app/components/base/file-uploader/types'import type { FormInputItem } from '@/app/components/workflow/nodes/human-input/types'import type { Locale } from '@/i18n'import type { HumanInputResolvedValue } from '@/types/workflow'@@ -81,12 +80,7 @@ export const initializeInputs = (}const isHumanInputFileUploaded = (value: HumanInputFieldValue | undefined) => {- return (- !!value &&- !Array.isArray(value) &&- typeof value !== 'string' &&- !!fileIsUploaded(value as FileEntity)- )+ return !!value && !Array.isArray(value) && typeof value !== 'string' && !!fileIsUploaded(value)}const hasUploadedHumanInputFiles = (value: HumanInputFieldValue | undefined) => {@@ -164,7 +158,7 @@ export const getProcessedHumanInputFormInputs = (}processedInputs[input.output_variable_name] =- value && typeof value !== 'string' ? getProcessedFiles([value as FileEntity])[0] : undefined+ value && typeof value !== 'string' ? getProcessedFiles([value])[0] : undefined}})diff --git a/web/app/components/base/chat/chat/check-input-forms-hooks.ts b/web/app/components/base/chat/chat/check-input-forms-hooks.tsindex 8348581d3cf..ddb6b0ff4d8 100644--- a/web/app/components/base/chat/chat/check-input-forms-hooks.ts+++ b/web/app/components/base/chat/chat/check-input-forms-hooks.ts@@ -18,7 +18,7 @@ export const useCheckInputsForms = () => {requiredVars.forEach(({ variable, label, type }) => {if (hasEmptyInput) returnif (fileIsUploading) return- if (!inputs[variable]) hasEmptyInput = label as string+ if (!inputs[variable]) hasEmptyInput = labelif ((type === InputVarType.singleFile || type === InputVarType.multiFiles) &&inputs[variable]diff --git a/web/app/components/base/chat/chat/hooks.ts b/web/app/components/base/chat/chat/hooks.tsindex 145bfd3b8fe..b5ce800b0ae 100644--- a/web/app/components/base/chat/chat/hooks.ts+++ b/web/app/components/base/chat/chat/hooks.ts@@ -896,7 +896,7 @@ export const useChat = ()})if (currentIndex > -1)- responseItem.workflowProcess.tracing[currentIndex] = nodeFinishedData as any+ responseItem.workflowProcess.tracing[currentIndex] = nodeFinishedData})},onTTSChunk: (messageId: string, audio: string, audioType?: string) => {@@ -1627,7 +1627,7 @@ export const useChat = (nodeFinishedData.execution_metadata?.parallel_id)})- responseItem.workflowProcess!.tracing[currentIndex] = nodeFinishedData as any+ responseItem.workflowProcess!.tracing[currentIndex] = nodeFinishedDataupdateCurrentQAOnTree({placeholderQuestionId,diff --git a/web/app/components/base/chat/embedded-chatbot/__tests__/hooks.spec.tsx b/web/app/components/base/chat/embedded-chatbot/__tests__/hooks.spec.tsxindex a33a74669f3..5aa2c2997ea 100644--- a/web/app/components/base/chat/embedded-chatbot/__tests__/hooks.spec.tsx+++ b/web/app/components/base/chat/embedded-chatbot/__tests__/hooks.spec.tsx@@ -581,9 +581,7 @@ describe('useEmbeddedChatbot', () => {})const onStart = vi.fn()act(() => {- ;(- result.current as unknown as { handleStartChat: (cb?: () => void) => void }- ).handleStartChat(onStart)+ ;(result.current as { handleStartChat: (cb?: () => void) => void }).handleStartChat(onStart)})expect(onStart).not.toHaveBeenCalled()@@ -600,9 +598,9 @@ describe('useEmbeddedChatbot', () => {const callback = vi.fn()act(() => {- ;(- result.current as unknown as { handleStartChat: (cb?: () => void) => void }- ).handleStartChat(callback)+ ;(result.current as { handleStartChat: (cb?: () => void) => void }).handleStartChat(+ callback,+ )})expect(callback).toHaveBeenCalled()@@ -620,9 +618,7 @@ describe('useEmbeddedChatbot', () => {})const onStart = vi.fn()act(() => {- ;(- result.current as unknown as { handleStartChat: (cb?: () => void) => void }- ).handleStartChat(onStart)+ ;(result.current as { handleStartChat: (cb?: () => void) => void }).handleStartChat(onStart)})expect(onStart).toHaveBeenCalled()diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsxindex 3a3eb573612..80505401ed7 100644--- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx+++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx@@ -117,9 +117,9 @@ export const useEmbeddedChatbot = (appSourceType: AppSourceType, tryAppId?: stri} else if (localeFromSysVar) {// If locale is set as a system variable, use thatawait changeLanguage(localeFromSysVar)- } else if ((appInfo as unknown as AppData)?.site?.default_language) {+ } else if ((appInfo as AppData)?.site?.default_language) {// Otherwise use the default from app config- await changeLanguage((appInfo as unknown as AppData).site?.default_language)+ await changeLanguage((appInfo as AppData).site?.default_language)}}setLanguageFromParams()diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsxindex 8895703b2dd..d2de530fb1e 100644--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx@@ -140,7 +140,7 @@ describe('InputsFormContent', () => {beforeEach(() => {vi.clearAllMocks()- vi.mocked(useEmbeddedChatbotContext).mockReturnValue(mockContextValue as unknown as any)+ vi.mocked(useEmbeddedChatbotContext).mockReturnValue(mockContextValue as any)})it('should render visible input forms', () => {@@ -251,7 +251,7 @@ describe('InputsFormContent', () => {},}- vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithValues as unknown as any)+ vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithValues as any)render(<InputsFormContent />)expect(screen.getByDisplayValue('initial value'))!.toBeInTheDocument()@@ -266,7 +266,7 @@ describe('InputsFormContent', () => {},}- vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithConv as unknown as any)+ vi.mocked(useEmbeddedChatbotContext).mockReturnValue(contextWithConv as any)render(<InputsFormContent />)expect(screen.getByDisplayValue('conv value'))!.toBeInTheDocument()diff --git a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/index.spec.tsx b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/index.spec.tsxindex 053f1f43cd0..2238a32e89c 100644--- a/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/index.spec.tsx+++ b/web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/index.spec.tsx@@ -30,7 +30,7 @@ describe('InputsFormNode', () => {beforeEach(() => {vi.clearAllMocks()- vi.mocked(useEmbeddedChatbotContext).mockReturnValue(mockContextValue as unknown as any)+ vi.mocked(useEmbeddedChatbotContext).mockReturnValue(mockContextValue as any)})it('should return null if allInputsHidden is true', () => {diff --git a/web/app/components/base/form/components/base/__tests__/base-field.spec.tsx b/web/app/components/base/form/components/base/__tests__/base-field.spec.tsxindex b19b828a99d..9581c0ca4d8 100644--- a/web/app/components/base/form/components/base/__tests__/base-field.spec.tsx+++ b/web/app/components/base/form/components/base/__tests__/base-field.spec.tsx@@ -50,7 +50,7 @@ const renderBaseField = ({<form.Field name={formSchema.name}>{(field) => (<BaseField- field={field as unknown as AnyFieldApi}+ field={field as AnyFieldApi}formSchema={formSchema}fieldState={fieldState}onChange={onChange}diff --git a/web/app/components/base/form/components/form/__tests__/actions.spec.tsx b/web/app/components/base/form/components/form/__tests__/actions.spec.tsxindex 2ca526c0029..cba58ad42b2 100644--- a/web/app/components/base/form/components/form/__tests__/actions.spec.tsx+++ b/web/app/components/base/form/components/form/__tests__/actions.spec.tsx@@ -42,7 +42,7 @@ const renderWithForm = ({}render(- <formContext.Provider value={form as unknown as FormType}>+ <formContext.Provider value={form as FormType}><Actions CustomActions={CustomActions} /></formContext.Provider>,)diff --git a/web/app/components/base/form/form-scenarios/base/field.tsx b/web/app/components/base/form/form-scenarios/base/field.tsxindex c88196b3be2..089271c3f2a 100644--- a/web/app/components/base/form/form-scenarios/base/field.tsx+++ b/web/app/components/base/form/form-scenarios/base/field.tsx@@ -38,7 +38,7 @@ const BaseField = ({ initialData, config }: BaseFieldProps) =>if (!showConditions.length) return truereturn showConditions.every((condition) => {const { variable, value } = condition- const fieldValue = fieldValues[variable as keyof typeof fieldValues]+ const fieldValue = fieldValues[variable]return fieldValue === value})})diff --git a/web/app/components/base/form/form-scenarios/input-field/field.tsx b/web/app/components/base/form/form-scenarios/input-field/field.tsxindex 33edcc01661..274a4424ea6 100644--- a/web/app/components/base/form/form-scenarios/input-field/field.tsx+++ b/web/app/components/base/form/form-scenarios/input-field/field.tsx@@ -35,7 +35,7 @@ const InputField = ({ initialData, config }: InputFieldProps) =>const fieldValues = state.valuesreturn showConditions.every((condition) => {const { variable, value } = condition- const fieldValue = fieldValues[variable as keyof typeof fieldValues]+ const fieldValue = fieldValues[variable]return fieldValue === value})})diff --git a/web/app/components/base/form/hooks/__tests__/use-get-form-values.spec.ts b/web/app/components/base/form/hooks/__tests__/use-get-form-values.spec.tsindex 4ee3b76be08..fcd44db1149 100644--- a/web/app/components/base/form/hooks/__tests__/use-get-form-values.spec.ts+++ b/web/app/components/base/form/hooks/__tests__/use-get-form-values.spec.ts@@ -26,7 +26,7 @@ describe('useGetFormValues', () => {store: { state: { values: { name: 'Alice' } } },}- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, []))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, []))expect(result.current.getFormValues({ needCheckValidatedValues: false })).toEqual({values: { name: 'Alice' },@@ -49,7 +49,7 @@ describe('useGetFormValues', () => {mockCheckValidated.mockReturnValue(true)mockTransform.mockReturnValue({ password: '[__HIDDEN__]' })- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, schemas))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, schemas))expect(result.current.getFormValues({@@ -68,7 +68,7 @@ describe('useGetFormValues', () => {}mockCheckValidated.mockReturnValue(false)- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, []))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, []))expect(result.current.getFormValues({ needCheckValidatedValues: true })).toEqual({values: {},@@ -90,7 +90,7 @@ describe('useGetFormValues', () => {]mockCheckValidated.mockReturnValue(true)- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, schemas))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, schemas))expect(result.current.getFormValues({@@ -118,7 +118,7 @@ describe('useGetFormValues', () => {]mockCheckValidated.mockReturnValue(true)- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, schemas))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, schemas))expect(result.current.getFormValues({@@ -137,7 +137,7 @@ describe('useGetFormValues', () => {store: { state: { values: {} } },}- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, []))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, []))expect(result.current.getFormValues({ needCheckValidatedValues: false })).toEqual({values: {},@@ -151,7 +151,7 @@ describe('useGetFormValues', () => {store: { state: { values: null } },}- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, []))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, []))expect(result.current.getFormValues({ needCheckValidatedValues: false })).toEqual({values: {},@@ -174,7 +174,7 @@ describe('useGetFormValues', () => {mockCheckValidated.mockReturnValue(true)mockTransform.mockReturnValue({ password: 'encrypted' })- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, schemas))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, schemas))result.current.getFormValues({needCheckValidatedValues: true,@@ -198,7 +198,7 @@ describe('useGetFormValues', () => {]mockCheckValidated.mockReturnValue(false)- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, schemas))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, schemas))expect(result.current.getFormValues({@@ -224,7 +224,7 @@ describe('useGetFormValues', () => {},}- const { result } = renderHook(() => useGetFormValues(form as unknown as AnyFormApi, []))+ const { result } = renderHook(() => useGetFormValues(form as AnyFormApi, []))expect(result.current.getFormValues({ needCheckValidatedValues: false })).toEqual({values: {diff --git a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsxindex 7ad03b5ceb9..91f3ab8ae07 100644--- a/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx+++ b/web/app/components/base/markdown-blocks/__tests__/code-block.spec.tsx@@ -162,8 +162,8 @@ describe('CodeBlock', () => {const windowWithLegacyAudio = window as WindowWithLegacyAudiooriginalAudioContext = windowWithLegacyAudio.AudioContextoriginalWebkitAudioContext = windowWithLegacyAudio.webkitAudioContext- windowWithLegacyAudio.AudioContext = MockAudioContext as unknown as AudioContextCtor- windowWithLegacyAudio.webkitAudioContext = MockAudioContext as unknown as AudioContextCtor+ windowWithLegacyAudio.AudioContext = MockAudioContext as AudioContextCtor+ windowWithLegacyAudio.webkitAudioContext = MockAudioContext as AudioContextCtordelete windowWithLegacyAudio.abcjsAudioContext})@@ -370,7 +370,7 @@ describe('CodeBlock', () => {it('should stop processing extra finished events when chart finished callback fires repeatedly', async () => {render(<CodeBlock className="language-echarts">{'{"series":[]}'}</CodeBlock>)const chart = await findEchartsInstance()- const chartWithTrigger = chart as unknown as {+ const chartWithTrigger = chart as {trigger?: (eventName: string, event?: unknown) => void}diff --git a/web/app/components/base/markdown/streamdown-wrapper.tsx b/web/app/components/base/markdown/streamdown-wrapper.tsxindex dbb2e19a9c7..d8a11391907 100644--- a/web/app/components/base/markdown/streamdown-wrapper.tsx+++ b/web/app/components/base/markdown/streamdown-wrapper.tsx@@ -110,7 +110,7 @@ function buildRehypePlugins(extraPlugins?: PluggableList): PluggableList {const overrideNames = new Set(ALLOWED_TAGS[tag])const filtered = existing.filter((entry) => {const name = typeof entry === 'string' ? entry : entry[0]- return !overrideNames.has(name as string)+ return !overrideNames.has(name)})mergedAttributes[tag] = [...filtered, ...(ALLOWED_TAGS[tag] ?? [])]} else {diff --git a/web/app/components/base/mermaid/index.tsx b/web/app/components/base/mermaid/index.tsxindex 13cd1fcc377..16233a70473 100644--- a/web/app/components/base/mermaid/index.tsx+++ b/web/app/components/base/mermaid/index.tsx@@ -272,8 +272,8 @@ const Flowchart = (props: FlowchartProps) => {// Step 4: Clean up SVG codeconst cleanedSvg = cleanUpSvgCode(processedSvg)- diagramCache.set(cacheKey, cleanedSvg as string)- setSvgString(cleanedSvg as string)+ diagramCache.set(cacheKey, cleanedSvg)+ setSvgString(cleanedSvg)setIsLoading(false)} catch (error) {@@ -328,7 +328,7 @@ const Flowchart = (props: FlowchartProps) => {curve: 'linear',ranker: 'tight-tree',}- config.flowchart = flowchartConfig as unknown as MermaidConfig['flowchart']+ config.flowchart = flowchartConfig as MermaidConfig['flowchart']}if (currentTheme === 'dark') {diff --git a/web/app/components/base/message-log-modal/index.stories.tsx b/web/app/components/base/message-log-modal/index.stories.tsxindex fc469231a1c..afb87338493 100644--- a/web/app/components/base/message-log-modal/index.stories.tsx+++ b/web/app/components/base/message-log-modal/index.stories.tsx@@ -114,7 +114,7 @@ const useMessageLogMocks = () => {throw new Error(`Unmocked fetch call for ${url}`)}- globalThis.fetch = handle as typeof globalThis.fetch+ globalThis.fetch = handlereturn () => {globalThis.fetch = originalFetch || globalThis.fetchdiff --git a/web/app/components/base/notion-page-selector/index.stories.tsx b/web/app/components/base/notion-page-selector/index.stories.tsxindex 30457bdd8d1..aed090b5c4d 100644--- a/web/app/components/base/notion-page-selector/index.stories.tsx+++ b/web/app/components/base/notion-page-selector/index.stories.tsx@@ -145,7 +145,7 @@ const useMockNotionApi = () => {throw new Error(`Unmocked fetch call for ${url}`)}- globalThis.fetch = handler as typeof globalThis.fetch+ globalThis.fetch = handlerreturn () => {if (originalFetch) globalThis.fetch = originalFetchdiff --git a/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx b/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsxindex 31cdf1196eb..51df4a5732a 100644--- a/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx+++ b/web/app/components/base/prompt-editor/__tests__/hooks.spec.tsx@@ -380,7 +380,7 @@ describe('prompt-editor/hooks', () => {const { unmount } = render(<LexicalTextEntityHarnessgetMatch={getMatch}- targetNode={MockTargetNode as unknown as Klass<TextNode>}+ targetNode={MockTargetNode as Klass<TextNode>}createNode={createNode}/>,)diff --git a/web/app/components/base/prompt-editor/__tests__/utils.spec.ts b/web/app/components/base/prompt-editor/__tests__/utils.spec.tsindex bd6080a4726..126b5a4c4a3 100644--- a/web/app/components/base/prompt-editor/__tests__/utils.spec.ts+++ b/web/app/components/base/prompt-editor/__tests__/utils.spec.ts@@ -67,7 +67,7 @@ describe('prompt-editor/utils', () => {mockState.createTextNode.mockReturnValue(createdTextNode)const getMatch = vi.fn(() => null)type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -97,7 +97,7 @@ describe('prompt-editor/utils', () => {// match.start = 2 (non-zero) → replaceWithSimpleTextconst getMatch = vi.fn(() => ({ start: 2, end: 4 }))type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -122,7 +122,7 @@ describe('prompt-editor/utils', () => {const { editor, registerNodeTransform } = makeEditor()const getMatch = vi.fn(() => ({ start: 0, end: 4 }))type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -156,7 +156,7 @@ describe('prompt-editor/utils', () => {mockState.createTextNode.mockReturnValue(createdTextNode)const getMatch = vi.fn(() => ({ start: 0, end: 4 }))type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -191,7 +191,7 @@ describe('prompt-editor/utils', () => {mockState.createTextNode.mockReturnValue(createdTextNode)const getMatch = vi.fn(() => ({ start: 0, end: 4 }))type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -246,7 +246,7 @@ describe('prompt-editor/utils', () => {const createdTextNode = { setFormat: vi.fn() }mockState.createTextNode.mockReturnValue(createdTextNode)type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -283,7 +283,7 @@ describe('prompt-editor/utils', () => {const createdTextNode = { setFormat: vi.fn() }mockState.createTextNode.mockReturnValue(createdTextNode)type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -319,7 +319,7 @@ describe('prompt-editor/utils', () => {const { editor, registerNodeTransform } = makeEditor()mockState.createTextNode.mockReturnValue({ setFormat: vi.fn() })type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -354,7 +354,7 @@ describe('prompt-editor/utils', () => {const { editor, registerNodeTransform } = makeEditor()mockState.createTextNode.mockReturnValue({ setFormat: vi.fn() })type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn(() => replacementNode as unknown as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -686,7 +686,7 @@ describe('prompt-editor/utils', () => {// getMatch always returns null → while loop: nextSibling found, nextMatch=null, isTargetNode=trueconst getMatch = vi.fn(() => null)type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -725,7 +725,7 @@ describe('prompt-editor/utils', () => {// first: null (match===null → nextText=''); combined nextMatch.start !== 0const getMatch = vi.fn(() => (n++ === 1 ? { start: 3, end: 7 } : null))type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -769,7 +769,7 @@ describe('prompt-editor/utils', () => {const replacementNode = { setFormat: vi.fn(), replace: vi.fn() }type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn(() => replacementNode as unknown as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -823,7 +823,7 @@ describe('prompt-editor/utils', () => {})type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((node: TextNode) => node as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -919,7 +919,7 @@ describe('prompt-editor/utils', () => {const getMatch = vi.fn()const { editor, registerNodeTransform } = makeEditor()type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -960,7 +960,7 @@ describe('prompt-editor/utils', () => {})type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)// Need text='cd' node@@ -1033,7 +1033,7 @@ describe('prompt-editor/utils', () => {const { editor, registerNodeTransform } = makeEditor()mockState.createTextNode.mockReturnValue({ setFormat: vi.fn() })type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)@@ -1073,7 +1073,7 @@ describe('prompt-editor/utils', () => {const { editor, registerNodeTransform } = makeEditor()mockState.createTextNode.mockReturnValue({ setFormat: vi.fn() })type TN = InstanceType<typeof TargetNode> & TextNode- const targetNodeClass = TargetNode as unknown as Klass<TN>+ const targetNodeClass = TargetNode as Klass<TN>const createNode = vi.fn((n: TextNode) => n as TN)registerLexicalTextEntity(editor, getMatch, targetNodeClass, createNode)diff --git a/web/app/components/base/prompt-editor/plugins/agent-output-block/__tests__/node.spec.tsx b/web/app/components/base/prompt-editor/plugins/agent-output-block/__tests__/node.spec.tsxindex 5c5d7e15e5f..3b4796b0a42 100644--- a/web/app/components/base/prompt-editor/plugins/agent-output-block/__tests__/node.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/agent-output-block/__tests__/node.spec.tsx@@ -14,7 +14,7 @@ describe('AgentOutputBlockNode', () => {beforeEach(() => {vi.clearAllMocks()editor = createEditor({- nodes: [AgentOutputBlockNode as unknown as Klass<LexicalNode>],+ nodes: [AgentOutputBlockNode as Klass<LexicalNode>],})})diff --git a/web/app/components/base/prompt-editor/plugins/context-block/component.tsx b/web/app/components/base/prompt-editor/plugins/context-block/component.tsxindex a55edcab1be..3254293f1fc 100644--- a/web/app/components/base/prompt-editor/plugins/context-block/component.tsx+++ b/web/app/components/base/prompt-editor/plugins/context-block/component.tsx@@ -32,7 +32,7 @@ const ContextBlockComponent: FC<ContextBlockComponentProps> = ({if (typeof event === 'string') returnif (event?.type === UPDATE_DATASETS_EVENT_EMITTER && Array.isArray(event.payload))- setLocalDatasets(event.payload as Dataset[])+ setLocalDatasets(event.payload)})return (diff --git a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/node.spec.tsx b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/node.spec.tsxindex 76f058a852d..2bdb5a75ea6 100644--- a/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/node.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/error-message-block/__tests__/node.spec.tsx@@ -8,7 +8,7 @@ describe('ErrorMessageBlockNode', () => {beforeEach(() => {vi.clearAllMocks()editor = createEditor({- nodes: [ErrorMessageBlockNode as unknown as Klass<LexicalNode>],+ nodes: [ErrorMessageBlockNode as Klass<LexicalNode>],})})diff --git a/web/app/components/base/prompt-editor/plugins/roster-reference-block/__tests__/node.spec.tsx b/web/app/components/base/prompt-editor/plugins/roster-reference-block/__tests__/node.spec.tsxindex e2d0931c76a..15b44f6964a 100644--- a/web/app/components/base/prompt-editor/plugins/roster-reference-block/__tests__/node.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/roster-reference-block/__tests__/node.spec.tsx@@ -13,7 +13,7 @@ describe('RosterReferenceBlockNode', () => {beforeEach(() => {vi.clearAllMocks()editor = createEditor({- nodes: [RosterReferenceBlockNode as unknown as Klass<LexicalNode>],+ nodes: [RosterReferenceBlockNode as Klass<LexicalNode>],})})diff --git a/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/node.spec.tsx b/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/node.spec.tsxindex 6165ac2c0af..4f2d0fb6271 100644--- a/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/node.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/variable-value-block/__tests__/node.spec.tsx@@ -8,7 +8,7 @@ describe('VariableValueBlockNode', () => {beforeEach(() => {vi.clearAllMocks()editor = createEditor({- nodes: [VariableValueBlockNode as unknown as Klass<LexicalNode>],+ nodes: [VariableValueBlockNode as Klass<LexicalNode>],})})diff --git a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/node.spec.tsx b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/node.spec.tsxindex 9ea5652ef1a..79463e16a30 100644--- a/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/node.spec.tsx+++ b/web/app/components/base/prompt-editor/plugins/workflow-variable-block/__tests__/node.spec.tsx@@ -11,7 +11,7 @@ describe('WorkflowVariableBlockNode', () => {beforeEach(() => {vi.clearAllMocks()editor = createEditor({- nodes: [WorkflowVariableBlockNode as unknown as Klass<LexicalNode>],+ nodes: [WorkflowVariableBlockNode as Klass<LexicalNode>],})})diff --git a/web/app/components/base/sort/__tests__/index.spec.tsx b/web/app/components/base/sort/__tests__/index.spec.tsxindex 06d8998e4e5..eca931c1243 100644--- a/web/app/components/base/sort/__tests__/index.spec.tsx+++ b/web/app/components/base/sort/__tests__/index.spec.tsx@@ -22,7 +22,7 @@ describe('Sort component — real portal integration', () => {const getTriggerWrapper = (): HTMLElement => {const wrapper = screen.getByRole('button', { name: /appLog\.filter\.sortBy/i })if (!wrapper) throw new Error('Trigger wrapper element not found for "Sort by" label')- return wrapper as HTMLElement+ return wrapper}// helper: returns right-side sort button elementdiff --git a/web/app/components/base/sort/index.stories.tsx b/web/app/components/base/sort/index.stories.tsxindex ca6127e3b4f..9105b4f6b62 100644--- a/web/app/components/base/sort/index.stories.tsx+++ b/web/app/components/base/sort/index.stories.tsx@@ -33,7 +33,7 @@ const SortPlayground = () => {value={value}items={SORT_ITEMS}onSelect={(next) => {- setSortBy(next as string)+ setSortBy(next)}}/></div>diff --git a/web/app/components/base/svg-gallery/index.tsx b/web/app/components/base/svg-gallery/index.tsxindex 5893e155437..6abb6f594a6 100644--- a/web/app/components/base/svg-gallery/index.tsx+++ b/web/app/components/base/svg-gallery/index.tsx@@ -39,7 +39,7 @@ const SVGRenderer = ({ content }: { content: string }) => {const rootElement = draw.svg(DOMPurify.sanitize(content))rootElement.click(() => {- setImagePreview(svgToDataURL(svgElement as Element))+ setImagePreview(svgToDataURL(svgElement))})} catch {/* v8 ignore next 2 -- if unmounted while handling parser/render errors, ref becomes null; guard avoids writing to a detached node. @preserve */diff --git a/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts b/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.tsindex bc782e5b627..8533770117c 100644--- a/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts+++ b/web/app/components/datasets/common/image-uploader/__tests__/utils.spec.ts@@ -223,7 +223,7 @@ describe('image-uploader utils', () => {name?: stringfile?: (callback: FileCallback) => voidcreateReader?: () => { readEntries: (callback: EntriesCallback) => void }- }): FileSystemEntry => props as unknown as FileSystemEntry+ }): FileSystemEntry => props as FileSystemEntryit('should resolve with file array for file entry', async () => {const mockFile: MockFile = { name: 'test.png' }diff --git a/web/app/components/datasets/create/file-uploader/components/__tests__/upload-dropzone.spec.tsx b/web/app/components/datasets/create/file-uploader/components/__tests__/upload-dropzone.spec.tsxindex 394fa2694e5..9ece94df9ba 100644--- a/web/app/components/datasets/create/file-uploader/components/__tests__/upload-dropzone.spec.tsx+++ b/web/app/components/datasets/create/file-uploader/components/__tests__/upload-dropzone.spec.tsx@@ -174,13 +174,7 @@ describe('UploadDropzone', () => {it('should render drag overlay when dragging', () => {const dragRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone- {...defaultProps}- dragging={true}- dragRef={dragRef as RefObject<HTMLDivElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} dragging={true} dragRef={dragRef} />)const overlay = document.querySelector('.absolute.left-0.top-0')expect(overlay).toBeInTheDocument()})@@ -221,32 +215,19 @@ describe('UploadDropzone', () => {describe('refs', () => {it('should attach dropRef to drop container', () => {const dropRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone {...defaultProps} dropRef={dropRef as RefObject<HTMLDivElement | null>} />,- )+ render(<UploadDropzone {...defaultProps} dropRef={dropRef} />)expect(dropRef.current).toBeInstanceOf(HTMLDivElement)})it('should attach fileUploaderRef to input element', () => {const fileUploaderRef = createMockRef<HTMLInputElement>()- render(- <UploadDropzone- {...defaultProps}- fileUploaderRef={fileUploaderRef as RefObject<HTMLInputElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} fileUploaderRef={fileUploaderRef} />)expect(fileUploaderRef.current).toBeInstanceOf(HTMLInputElement)})it('should attach dragRef to overlay when dragging', () => {const dragRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone- {...defaultProps}- dragging={true}- dragRef={dragRef as RefObject<HTMLDivElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} dragging={true} dragRef={dragRef} />)expect(dragRef.current).toBeInstanceOf(HTMLDivElement)})})diff --git a/web/app/components/datasets/documents/__tests__/index.spec.tsx b/web/app/components/datasets/documents/__tests__/index.spec.tsxindex 925b6da1227..7fac64be484 100644--- a/web/app/components/datasets/documents/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/__tests__/index.spec.tsx@@ -675,7 +675,7 @@ describe('Documents', () => {vi.mocked(useDatasetDetailContextWithSelector).mockImplementation((selector: MockSelector) => {const mockState = { dataset: undefined }- return selector(mockState as MockState)+ return selector(mockState)},)diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/__tests__/upload-dropzone.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/__tests__/upload-dropzone.spec.tsxindex fae7175f570..51d83301a0b 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/__tests__/upload-dropzone.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/components/__tests__/upload-dropzone.spec.tsx@@ -186,13 +186,7 @@ describe('UploadDropzone', () => {it('should render drag overlay when dragging', () => {const dragRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone- {...defaultProps}- dragging={true}- dragRef={dragRef as RefObject<HTMLDivElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} dragging={true} dragRef={dragRef} />)const overlay = document.querySelector('.absolute.left-0.top-0')expect(overlay).toBeInTheDocument()@@ -235,34 +229,21 @@ describe('UploadDropzone', () => {describe('refs', () => {it('should attach dropRef to drop container', () => {const dropRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone {...defaultProps} dropRef={dropRef as RefObject<HTMLDivElement | null>} />,- )+ render(<UploadDropzone {...defaultProps} dropRef={dropRef} />)expect(dropRef.current).toBeInstanceOf(HTMLDivElement)})it('should attach fileUploaderRef to input element', () => {const fileUploaderRef = createMockRef<HTMLInputElement>()- render(- <UploadDropzone- {...defaultProps}- fileUploaderRef={fileUploaderRef as RefObject<HTMLInputElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} fileUploaderRef={fileUploaderRef} />)expect(fileUploaderRef.current).toBeInstanceOf(HTMLInputElement)})it('should attach dragRef to overlay when dragging', () => {const dragRef = createMockRef<HTMLDivElement>()- render(- <UploadDropzone- {...defaultProps}- dragging={true}- dragRef={dragRef as RefObject<HTMLDivElement | null>}- />,- )+ render(<UploadDropzone {...defaultProps} dragging={true} dragRef={dragRef} />)expect(dragRef.current).toBeInstanceOf(HTMLDivElement)})diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsxindex b0a1574eb50..4aef4ff991d 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/local-file/hooks/__tests__/use-local-file-upload.spec.tsx@@ -273,7 +273,7 @@ describe('useLocalFileUpload', () => {const mockFile = { name: 'test.pdf', size: 1024 }act(() => {- result.current.handlePreview(mockFile as unknown as CustomFile)+ result.current.handlePreview(mockFile as CustomFile)})expect(mockSetCurrentLocalFile).not.toHaveBeenCalled()diff --git a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsxindex 18f7d47f853..cb2b11fe5c6 100644--- a/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx+++ b/web/app/components/datasets/documents/create-from-pipeline/data-source/online-documents/__tests__/index.spec.tsx@@ -89,7 +89,7 @@ const mockDataSourceStore = { getState: mockGetState }vi.mock('../../store', () => ({useDataSourceStoreWithSelector: (selector: (s: Record<string, unknown>) => unknown) =>- selector(mockStoreState as unknown as Record<string, unknown>),+ selector(mockStoreState),useDataSourceStore: () => mockDataSourceStore,}))diff --git a/web/app/components/datasets/documents/create-from-pipeline/utils/__tests__/datasource-info-builder.spec.ts b/web/app/components/datasets/documents/create-from-pipeline/utils/__tests__/datasource-info-builder.spec.tsindex 2421d168904..4aa4c9ed3ae 100644--- a/web/app/components/datasets/documents/create-from-pipeline/utils/__tests__/datasource-info-builder.spec.ts+++ b/web/app/components/datasets/documents/create-from-pipeline/utils/__tests__/datasource-info-builder.spec.ts@@ -56,9 +56,9 @@ describe('datasource-info-builder', () => {const result = buildOnlineDocumentDatasourceInfo(page, 'cred-2')expect(result.workspace_id).toBe('ws-1')expect(result.credential_id).toBe('cred-2')- expect((result.page as unknown as Record<string, unknown>).page_id).toBe('page-1')+ expect((result.page as Record<string, unknown>).page_id).toBe('page-1')// workspace_id should not be in the page object- expect((result.page as unknown as Record<string, unknown>).workspace_id).toBeUndefined()+ expect((result.page as Record<string, unknown>).workspace_id).toBeUndefined()})})diff --git a/web/app/components/datasets/documents/detail/batch-modal/__tests__/csv-uploader.spec.tsx b/web/app/components/datasets/documents/detail/batch-modal/__tests__/csv-uploader.spec.tsxindex 061dcdb61b1..23732ac3cad 100644--- a/web/app/components/datasets/documents/detail/batch-modal/__tests__/csv-uploader.spec.tsx+++ b/web/app/components/datasets/documents/detail/batch-modal/__tests__/csv-uploader.spec.tsx@@ -515,7 +515,7 @@ describe('CSVUploader', () => {const dropEvent = new Event('drop', {bubbles: true,cancelable: true,- }) as unknown as DragEvent+ }) as DragEventObject.defineProperty(dropEvent, 'dataTransfer', {value: {files: [testFile],@@ -541,7 +541,7 @@ describe('CSVUploader', () => {const dropEvent = new Event('drop', {bubbles: true,cancelable: true,- }) as unknown as DragEvent+ }) as DragEventObject.defineProperty(dropEvent, 'dataTransfer', {value: {files: [file1, file2],diff --git a/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx b/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsxindex 51dd7d40874..8fd70ba41a6 100644--- a/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx+++ b/web/app/components/datasets/documents/detail/completed/common/__tests__/chunk-content.spec.tsx@@ -12,7 +12,7 @@ class MockResizeObserver {}beforeAll(() => {- globalThis.ResizeObserver = MockResizeObserver as typeof ResizeObserver+ globalThis.ResizeObserver = MockResizeObserver})afterAll(() => {diff --git a/web/app/components/explore/try-app/app/text-generation.tsx b/web/app/components/explore/try-app/app/text-generation.tsxindex 49687cec84d..406193d2ea7 100644--- a/web/app/components/explore/try-app/app/text-generation.tsx+++ b/web/app/components/explore/try-app/app/text-generation.tsx@@ -99,7 +99,7 @@ const TextGeneration: FC<Props> = ({ appId, className, isWorkflow, appData }) =>;(async () => {if (!appData || !appParams) returnconst { site: siteInfo, custom_config } = appData- setSiteInfo(siteInfo as SiteInfo)+ setSiteInfo(siteInfo)setCustomConfig(custom_config)const { user_input_form, more_like_this, file_upload, text_to_speech } = appParamsdiff --git a/web/app/components/header/account-setting/data-source-page-new/__tests__/index.spec.tsx b/web/app/components/header/account-setting/data-source-page-new/__tests__/index.spec.tsxindex 7bf37e59c9e..267ab5fea0a 100644--- a/web/app/components/header/account-setting/data-source-page-new/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/data-source-page-new/__tests__/index.spec.tsx@@ -193,9 +193,7 @@ describe('DataSourcePage Component', () => {isLoading: false,error: null,} as unknown as ReturnType<typeof useCheckInstalled>)- vi.mocked(usePluginsWithLatestVersion).mockImplementation(- (plugins = []) => plugins as PluginDetail[],- )+ vi.mocked(usePluginsWithLatestVersion).mockImplementation((plugins = []) => plugins)vi.mocked(useInvalidateInstalledPluginList).mockReturnValue(vi.fn())vi.mocked(useDataSourceAuthUpdate).mockReturnValue({ handleAuthUpdate: vi.fn() })vi.mocked(useMarketplaceAllPlugins).mockReturnValue({ plugins: [], isLoading: false })diff --git a/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx b/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsxindex f359dfb39d9..d7ac8064b6c 100644--- a/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx+++ b/web/app/components/header/account-setting/model-provider-page/__tests__/install-from-marketplace.spec.tsx@@ -145,7 +145,7 @@ describe('InstallFromMarketplace', () => {})it('should show loading state', () => {- ;(useMarketplaceAllPlugins as unknown as Mock).mockReturnValue({+ ;(useMarketplaceAllPlugins as Mock).mockReturnValue({plugins: [],isLoading: true,})@@ -156,7 +156,7 @@ describe('InstallFromMarketplace', () => {})it('should list plugins', () => {- ;(useMarketplaceAllPlugins as unknown as Mock).mockReturnValue({+ ;(useMarketplaceAllPlugins as Mock).mockReturnValue({plugins: [{ plugin_id: '1', name: 'Plugin 1' }],isLoading: false,})@@ -167,7 +167,7 @@ describe('InstallFromMarketplace', () => {})it('should anchor the tour target to the heading and first marketplace row', () => {- ;(useMarketplaceAllPlugins as unknown as Mock).mockReturnValue({+ ;(useMarketplaceAllPlugins as Mock).mockReturnValue({plugins: [{ plugin_id: '1', name: 'Plugin 1' },{ plugin_id: '2', name: 'Plugin 2' },@@ -198,7 +198,7 @@ describe('InstallFromMarketplace', () => {})it('should hide bundle plugins from the list', () => {- ;(useMarketplaceAllPlugins as unknown as Mock).mockReturnValue({+ ;(useMarketplaceAllPlugins as Mock).mockReturnValue({plugins: [{ plugin_id: '1', name: 'Plugin 1', type: 'plugin' },{ plugin_id: '2', name: 'Bundle 1', type: 'bundle' },diff --git a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsxindex 0b93c219dca..636377ae9d7 100644--- a/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx+++ b/web/app/components/header/account-setting/model-provider-page/model-parameter-modal/parameter-item.tsx@@ -114,12 +114,11 @@ function ParameterItem({let num = +e.target.valueif (!isNullOrUndefined(parameterRule.max) && num > parameterRule.max!) {- num = parameterRule.max as number+ num = parameterRule.maxnumberInputRef.current!.value = `${num}`}- if (!isNullOrUndefined(parameterRule.min) && num < parameterRule.min!)- num = parameterRule.min as number+ if (!isNullOrUndefined(parameterRule.min) && num < parameterRule.min!) num = parameterRule.minhandleInputChange(num)}diff --git a/web/app/components/header/account-setting/permissions-page/__tests__/index.spec.tsx b/web/app/components/header/account-setting/permissions-page/__tests__/index.spec.tsxindex d2e7604af4a..b395d15fc21 100644--- a/web/app/components/header/account-setting/permissions-page/__tests__/index.spec.tsx+++ b/web/app/components/header/account-setting/permissions-page/__tests__/index.spec.tsx@@ -159,14 +159,10 @@ describe('PermissionsPage', () => {error: null,} as ReturnType<typeof useRoleGroups>)vi.mocked(mockCreateWorkspaceRoleHook).mockReturnValue(- mockMutation(mocks.createWorkspaceRole) as unknown as ReturnType<- typeof mockCreateWorkspaceRoleHook- >,+ mockMutation(mocks.createWorkspaceRole) as ReturnType<typeof mockCreateWorkspaceRoleHook>,)vi.mocked(mockUpdateWorkspaceRoleHook).mockReturnValue(- mockMutation(mocks.updateWorkspaceRole) as unknown as ReturnType<- typeof mockUpdateWorkspaceRoleHook- >,+ mockMutation(mocks.updateWorkspaceRole) as ReturnType<typeof mockUpdateWorkspaceRoleHook>,)})diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsxindex 4f53561bfba..e46429a8010 100644--- a/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx+++ b/web/app/components/plugins/install-plugin/install-from-local-package/steps/uploading.tsx@@ -48,7 +48,7 @@ const Uploading: FC<Props> = ({(response: unknown) => {if (isBundle) {if (Array.isArray(response)) {- onBundleUploaded(response as Dependency[])+ onBundleUploaded(response)return}onFailed(t(($) => $[`${i18nPrefix}.uploadFailed`], { ns: 'plugin' }))diff --git a/web/app/components/plugins/marketplace/utils.ts b/web/app/components/plugins/marketplace/utils.tsindex cd3bd785691..6a7ba9b6875 100644--- a/web/app/components/plugins/marketplace/utils.ts+++ b/web/app/components/plugins/marketplace/utils.ts@@ -71,7 +71,7 @@ export const getPluginIconInMarketplace = (}export const getFormattedPlugin = (payload: MarketplacePluginPayload): Plugin => {- const plugin = payload as unknown as Plugin+ const plugin = payload as Pluginif (payload.type === 'bundle') {return {diff --git a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsxindex 5a7d1acd5de..4ba0927dc59 100644--- a/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx+++ b/web/app/components/plugins/plugin-auth/authorize/add-oauth-button.tsx@@ -175,7 +175,7 @@ const AddOAuthButton = ({[t, redirect_uri, renderI18nObject],)const memorizedSchemas = useMemo(() => {- const result: FormSchema[] = (schema as FormSchema[]).map((item, index) => {+ const result: FormSchema[] = schema.map((item, index) => {return {...item,label: index === 0 ? renderCustomLabel(item) : item.label,diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsxindex d540da82cb5..43c0ca80f45 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/components/modal-steps.tsx@@ -162,9 +162,7 @@ const AutoParametersForm = ({const formSchemas = React.useMemo(() =>schemas.map((schema) => {- const normalizedType = normalizeFormType(- (schema.type || FormTypeEnum.textInput) as FormTypeEnum | string,- )+ const normalizedType = normalizeFormType(schema.type || FormTypeEnum.textInput)return {...schema,tooltip: schema.description,diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsxindex ef1ce290311..6ec599cc54f 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/apikey-edit-modal.tsx@@ -255,7 +255,7 @@ export const ApiKeyEditModal = ({ onClose, subscription, pluginDetail }: Props)const credentialsFormSchemas: FormSchema[] = useMemo(() => {return apiKeyCredentialsSchema.map((schema) => ({...schema,- type: normalizeFormType(schema.type as string),+ type: normalizeFormType(schema.type),tooltip: schema.help,default: subscription.credentials?.[schema.name] || schema.default,}))@@ -263,7 +263,7 @@ export const ApiKeyEditModal = ({ onClose, subscription, pluginDetail }: Props)const parametersFormSchemas: FormSchema[] = useMemo(() => {return parametersSchema.map((schema: ParametersSchema) => {- const normalizedType = normalizeFormType(schema.type as string)+ const normalizedType = normalizeFormType(schema.type)return {...schema,type: normalizedType,diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsxindex 20a6a0c259d..4f0bf5eb6b2 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/manual-edit-modal.tsx@@ -121,7 +121,7 @@ export const ManualEditModal = ({ onClose, subscription, pluginDetail }: Props)},...propertiesSchema.map((schema: ParametersSchema) => ({...schema,- type: normalizeFormType(schema.type as string),+ type: normalizeFormType(schema.type),tooltip: schema.description,default: subscription.properties?.[schema.name] || schema.default,})),diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsxindex 9888f74af6f..139909db167 100644--- a/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx+++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/edit/oauth-edit-modal.tsx@@ -120,7 +120,7 @@ export const OAuthEditModal = ({ onClose, subscription, pluginDetail }: Props) =showCopy: true,},...parametersSchema.map((schema: ParametersSchema) => {- const normalizedType = normalizeFormType(schema.type as string)+ const normalizedType = normalizeFormType(schema.type)return {...schema,type: normalizedType,diff --git a/web/app/components/plugins/plugin-item/__tests__/index.spec.tsx b/web/app/components/plugins/plugin-item/__tests__/index.spec.tsxindex b437cacb9e5..30e1fa2793a 100644--- a/web/app/components/plugins/plugin-item/__tests__/index.spec.tsx+++ b/web/app/components/plugins/plugin-item/__tests__/index.spec.tsx@@ -132,7 +132,7 @@ const createPluginDeclaration = (resource: null,plugins: null,verified: false,- endpoint: undefined as unknown as PluginDeclaration['endpoint'],+ endpoint: undefined as PluginDeclaration['endpoint'],model: null,tags: [],agent_strategy: null,diff --git a/web/app/components/rag-pipeline/components/__tests__/update-dsl-modal.spec.tsx b/web/app/components/rag-pipeline/components/__tests__/update-dsl-modal.spec.tsxindex ed40afc2fa0..8a6b0728181 100644--- a/web/app/components/rag-pipeline/components/__tests__/update-dsl-modal.spec.tsx+++ b/web/app/components/rag-pipeline/components/__tests__/update-dsl-modal.spec.tsx@@ -13,7 +13,7 @@ class MockFileReader {}}-vi.stubGlobal('FileReader', MockFileReader as unknown as typeof FileReader)+vi.stubGlobal('FileReader', MockFileReader as typeof FileReader)const toastMocks = vi.hoisted(() => {const call = vi.fn()diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx b/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsxindex 9c5821f5442..6aaafcd07e3 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/field-item.tsx@@ -155,7 +155,7 @@ const FieldItem = ({<Badge>{t(($) => $['nodes.start.required'], { ns: 'workflow' })}</Badge>)}<InputVarTypeIcon- type={payload.type as unknown as InputVarType}+ type={payload.type as InputVarType}className="size-3 text-text-tertiary"/></div>diff --git a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.tsindex 6f788267249..dba2ea7cb42 100644--- a/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts+++ b/web/app/components/rag-pipeline/components/panel/input-field/field-list/hooks.ts@@ -64,7 +64,7 @@ export const useFieldList = ({if (isVarUsedInNodes([VARIABLE_PREFIX, nodeId, itemToRemove!.variable || ''])) {showRemoveVarConfirm()setRemovedVar([VARIABLE_PREFIX, nodeId, itemToRemove!.variable || ''])- setRemoveIndex(index as number)+ setRemoveIndex(index)return}const newInputFields = inputFieldsRef.current.filter((_, i) => i !== index)diff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.tsindex a70c1d80012..6e480999fbe 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-pipeline.spec.ts@@ -41,7 +41,7 @@ vi.mock('es-toolkit/compat', () => ({uniqBy: (arr: Array<{ id: string }>, key: string) => {const seen = new Set<string>()return arr.filter((item) => {- const val = item[key as keyof typeof item] as string+ const val = item[key as keyof typeof item]if (seen.has(val)) return falseseen.add(val)return truediff --git a/web/app/components/rag-pipeline/hooks/__tests__/use-update-dsl-modal.spec.ts b/web/app/components/rag-pipeline/hooks/__tests__/use-update-dsl-modal.spec.tsindex cac5525852e..58df7c41d6d 100644--- a/web/app/components/rag-pipeline/hooks/__tests__/use-update-dsl-modal.spec.ts+++ b/web/app/components/rag-pipeline/hooks/__tests__/use-update-dsl-modal.spec.ts@@ -13,7 +13,7 @@ class MockFileReader {this.onload?.call(this as unknown as FileReader, event)}}-vi.stubGlobal('FileReader', MockFileReader as unknown as typeof FileReader)+vi.stubGlobal('FileReader', MockFileReader as typeof FileReader)const toastMocks = vi.hoisted(() => {const call = vi.fn()@@ -188,7 +188,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockImportDSL).toHaveBeenCalledWith({@@ -204,7 +204,7 @@ describe('useUpdateDSLModal', () => {const { result } = renderUpdateDSLModal()await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockImportDSL).not.toHaveBeenCalled()@@ -217,7 +217,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }))@@ -230,7 +230,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockOnImport).toHaveBeenCalled()@@ -243,7 +243,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockOnCancel).toHaveBeenCalled()@@ -256,7 +256,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockEmit).toHaveBeenCalled()@@ -269,7 +269,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockHandleCheckPluginDependencies).toHaveBeenCalledWith('test-pipeline-id', true)@@ -288,7 +288,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'warning' }))@@ -311,7 +311,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()await vi.advanceTimersByTimeAsync(350)})@@ -342,7 +342,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()await vi.advanceTimersByTimeAsync(350)})@@ -368,7 +368,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith({@@ -386,7 +386,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))@@ -413,7 +413,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith({@@ -435,7 +435,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))@@ -459,7 +459,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()await vi.advanceTimersByTimeAsync(350)})@@ -478,7 +478,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(mockImportDSLConfirm).toHaveBeenCalledWith({ params: { import_id: 'import-id' } })@@ -494,7 +494,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'success' }))@@ -511,7 +511,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(mockOnImport).toHaveBeenCalled()@@ -528,7 +528,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith({@@ -544,7 +544,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))@@ -569,7 +569,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith({@@ -588,7 +588,7 @@ describe('useUpdateDSLModal', () => {await setupPendingState(result)await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(toastMocks.call).toHaveBeenCalledWith(expect.objectContaining({ type: 'error' }))@@ -598,7 +598,7 @@ describe('useUpdateDSLModal', () => {const { result } = renderUpdateDSLModal()await act(async () => {- await (result.current.onUpdateDSLConfirm as unknown as AsyncFn)()+ await (result.current.onUpdateDSLConfirm as AsyncFn)()})expect(mockImportDSLConfirm).not.toHaveBeenCalled()@@ -616,7 +616,7 @@ describe('useUpdateDSLModal', () => {})await act(async () => {- await (result.current.handleImport as unknown as AsyncFn)()+ await (result.current.handleImport as AsyncFn)()})expect(mockOnCancel).toHaveBeenCalled()diff --git a/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts b/web/app/components/rag-pipeline/hooks/use-pipeline-config.tsindex ff172f61a3f..547b9facce3 100644--- a/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts+++ b/web/app/components/rag-pipeline/hooks/use-pipeline-config.ts@@ -21,7 +21,7 @@ export const usePipelineConfig = () => {res[item.type] = item.config})} else {- res = nodesDefaultConfigs as Record<string, any>+ res = nodesDefaultConfigs}setNodesDefaultConfigs!(res)diff --git a/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts b/web/app/components/share/text-generation/hooks/use-text-generation-app-state.tsindex b8033a54252..544728bdddc 100644--- a/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts+++ b/web/app/components/share/text-generation/hooks/use-text-generation-app-state.ts@@ -131,8 +131,8 @@ export const useTextGenerationAppState = ({if (!appData || !appParams) returnconst { app_id: nextAppId, site, custom_config } = appDatasetAppId(nextAppId)- setSiteInfo(site as SiteInfo)- setCustomConfig((custom_config || null) as TextGenerationCustomConfig | null)+ setSiteInfo(site)+ setCustomConfig(custom_config || null)await changeLanguage(site.default_language)const { user_input_form, more_like_this, file_upload, text_to_speech } =appParams as unknown as ShareAppParamsdiff --git a/web/app/components/share/text-generation/result/result-request.ts b/web/app/components/share/text-generation/result/result-request.tsindex 9d54ec247bb..97c16a09ee6 100644--- a/web/app/components/share/text-generation/result/result-request.ts+++ b/web/app/components/share/text-generation/result/result-request.ts@@ -158,7 +158,7 @@ export const buildResultRequestData = ({}if (variable.type === 'file-list' && Array.isArray(value) && value.length > 0)- processedInputs[variable.key] = getProcessedFiles(value as FileEntity[])+ processedInputs[variable.key] = getProcessedFiles(value)})return {diff --git a/web/app/components/snippets/components/__tests__/snippet-sidebar.spec.tsx b/web/app/components/snippets/components/__tests__/snippet-sidebar.spec.tsxindex 796f43d9ee5..6f2aa1866d4 100644--- a/web/app/components/snippets/components/__tests__/snippet-sidebar.spec.tsx+++ b/web/app/components/snippets/components/__tests__/snippet-sidebar.spec.tsx@@ -44,7 +44,7 @@ vi.mock('@/app/components/app/configuration/config-var/config-modal', () => ({type="button"onClick={() =>props.onConfirm({- type: PipelineInputVarType.textInput as unknown as InputVar['type'],+ type: PipelineInputVarType.textInput as InputVar['type'],label: 'Question',variable: 'question',required: false,@@ -214,13 +214,13 @@ describe('SnippetSidebarContent', () => {fireEvent.click(screen.getByRole('button', { name: /common\.operation\.add/i }))capturedConfigVarModalProps?.onConfirm({- type: PipelineInputVarType.textInput as unknown as InputVar['type'],+ type: PipelineInputVarType.textInput as InputVar['type'],label: 'Another label',variable: 'query',required: true,})capturedConfigVarModalProps?.onConfirm({- type: PipelineInputVarType.textInput as unknown as InputVar['type'],+ type: PipelineInputVarType.textInput as InputVar['type'],label: 'Query',variable: 'another_query',required: true,diff --git a/web/app/components/snippets/components/snippet-main.tsx b/web/app/components/snippets/components/snippet-main.tsxindex 47edfa22ad2..1d2c3cbe5ea 100644--- a/web/app/components/snippets/components/snippet-main.tsx+++ b/web/app/components/snippets/components/snippet-main.tsx@@ -266,7 +266,7 @@ const SnippetMain = ({ draftPayload, draftNodes, draftEdges, draftViewport }: Snconst graph = syncedDraftPayload?.graphif (!graph || typeof graph !== 'object') return- const graphRecord = graph as Record<string, unknown>+ const graphRecord = graphconst draftGraph: SnippetCanvasData = {nodes: Array.isArray(graphRecord.nodes)? (graphRecord.nodes as SnippetCanvasData['nodes'])diff --git a/web/app/components/snippets/components/snippet-sidebar.tsx b/web/app/components/snippets/components/snippet-sidebar.tsxindex 207badc1591..ea50e4f074b 100644--- a/web/app/components/snippets/components/snippet-sidebar.tsx+++ b/web/app/components/snippets/components/snippet-sidebar.tsx@@ -28,13 +28,13 @@ type SnippetSidebarContentProps = SnippetSidebarProps & {const toWorkflowInputVar = (field: SnippetInputField): InputVar => ({...field,- type: field.type as unknown as InputVar['type'],+ type: field.type as InputVar['type'],})const toSnippetInputField = (field: InputVar): SnippetInputField => ({...field,label: typeof field.label === 'string' ? field.label : field.label.variable,- type: field.type as unknown as SnippetInputField['type'],+ type: field.type as SnippetInputField['type'],})export const SnippetSidebarContent = ({@@ -63,7 +63,7 @@ export const SnippetSidebarContent = ({if (hasDuplicateStr(nextFields.map((item) => item.variable))) {errorMsgKey = 'varKeyError.keyAlreadyExists'typeName = 'variableConfig.varName'- } else if (hasDuplicateStr(nextFields.map((item) => item.label as string))) {+ } else if (hasDuplicateStr(nextFields.map((item) => item.label))) {errorMsgKey = 'varKeyError.keyAlreadyExists'typeName = 'variableConfig.labelName'}diff --git a/web/app/components/tools/provider/detail.tsx b/web/app/components/tools/provider/detail.tsxindex 64f2ec50181..c64bea58416 100644--- a/web/app/components/tools/provider/detail.tsx+++ b/web/app/components/tools/provider/detail.tsx@@ -160,7 +160,7 @@ const ProviderDetail = ({ collection, onHide, onRefreshData }: Props) => {const doRemoveCustomToolCollection = async () => {if (!canManageTools) return- await removeCustomCollection(collection?.name as string)+ await removeCustomCollection(collection?.name)onRefreshData()setIsShowEditCustomCollectionModal(false)}diff --git a/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts b/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.tsindex 6f7c21cd497..635fd74c99c 100644--- a/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts+++ b/web/app/components/tools/workflow-tool/hooks/__tests__/use-configure-button.spec.ts@@ -527,10 +527,7 @@ describe('useConfigureButton', () => {)await act(async () => {- await result.current.handleUpdate(- createMockRequest({ workflow_tool_id: 'tool-456' }) as WorkflowToolProviderRequest &- Partial<{ workflow_app_id: string; workflow_tool_id: string }>,- )+ await result.current.handleUpdate(createMockRequest({ workflow_tool_id: 'tool-456' }))})expect(handlePublish).toHaveBeenCalled()@@ -556,10 +553,7 @@ describe('useConfigureButton', () => {)await act(async () => {- await result.current.handleUpdate(- createMockRequest() as WorkflowToolProviderRequest &- Partial<{ workflow_app_id: string; workflow_tool_id: string }>,- )+ await result.current.handleUpdate(createMockRequest())})expect(mockToastNotify).toHaveBeenCalledWith({ type: 'error', message: 'Publish failed' })@@ -573,10 +567,7 @@ describe('useConfigureButton', () => {)await act(async () => {- await result.current.handleUpdate(- createMockRequest() as WorkflowToolProviderRequest &- Partial<{ workflow_app_id: string; workflow_tool_id: string }>,- )+ await result.current.handleUpdate(createMockRequest())})expect(mockToastNotify).toHaveBeenCalledWith({ type: 'error', message: 'Save failed' })diff --git a/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx b/web/app/components/workflow-app/components/workflow-header/features-trigger.tsxindex 6912127aaec..c60223f9c12 100644--- a/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx+++ b/web/app/components/workflow-app/components/workflow-header/features-trigger.tsx@@ -134,10 +134,7 @@ const FeaturesTrigger = () => {return edges.some((edge) => startNodeIds.includes(edge.source))}, [edges, startNodeIds])// Track trigger presence so the publisher can adjust UI (e.g. hide missing start section).- const hasTriggerNode = useMemo(- () => nodes.some((node) => isTriggerNode(node.data.type as BlockEnum)),- [nodes],- )+ const hasTriggerNode = useMemo(() => nodes.some((node) => isTriggerNode(node.data.type)), [nodes])const startNodeLimitExceeded = useMemo(() => {const entryCount = nodes.reduce((count, node) => {const nodeType = node.data.type as BlockEnumdiff --git a/web/app/components/workflow/block-selector/all-start-blocks.tsx b/web/app/components/workflow/block-selector/all-start-blocks.tsxindex 7a476e69ddd..5072b3fda27 100644--- a/web/app/components/workflow/block-selector/all-start-blocks.tsx+++ b/web/app/components/workflow/block-selector/all-start-blocks.tsx@@ -196,7 +196,7 @@ function AllStartBlocks({<StartBlockssearchText={trimmedSearchText}onSelect={onSelect as OnSelectBlock}- availableBlocksTypes={entryNodeTypes as unknown as BlockEnum[]}+ availableBlocksTypes={entryNodeTypes}hideUserInput={!allowUserInputSelection && !hasTriggerNode}showMostCommonBadgeshowUserInputAdded={hasUserInputNode}diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.logs-and-events.spec.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.logs-and-events.spec.tsindex 97ec2ceadf4..a8b0c02a197 100644--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.logs-and-events.spec.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.logs-and-events.spec.ts@@ -397,8 +397,8 @@ describe('CollaborationManager logs and event helpers', () => {const { manager, internals } = setupManagerWithDoc()const updatedNode = createNode('n-after-undo-redo')const updatedEdge = createEdge('e-after-undo-redo', 'n-after-undo-redo', 'n-target')- internals.nodesMap?.set(updatedNode.id, updatedNode as unknown as Record<string, unknown>)- internals.edgesMap?.set(updatedEdge.id, updatedEdge as unknown as Record<string, unknown>)+ internals.nodesMap?.set(updatedNode.id, updatedNode as Record<string, unknown>)+ internals.edgesMap?.set(updatedEdge.id, updatedEdge as Record<string, unknown>)const setNodesSpy = vi.fn()const setEdgesSpy = vi.fn()diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.tsindex 078d8646e0f..413bfee672c 100644--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.socket-and-subscriptions.spec.ts@@ -1266,7 +1266,7 @@ describe('CollaborationManager socket and subscription behavior', () => {it('covers setNodes/setEdges guards and destroy delegation', () => {const { manager, internals } = setupManagerWithDoc()const destroyDisconnectSpy = vi- .spyOn(manager as unknown as { disconnect: () => void }, 'disconnect')+ .spyOn(manager as { disconnect: () => void }, 'disconnect').mockImplementation(() => undefined)manager.setNodes([], [createNode('n-guard')])diff --git a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.tsindex 973a17839f9..f70f2c50b69 100644--- a/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts+++ b/web/app/components/workflow/collaboration/core/__tests__/collaboration-manager.test.ts@@ -273,7 +273,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes(base, next)- const stored = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)+ const stored = manager.getNodes().find((node) => node.id === NODE_ID)expect(stored).toBeDefined()expect(getVariables(stored!)).toEqual(['a', 'b'])})@@ -285,12 +285,12 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes(base, userA)- const afterUserA = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)+ const afterUserA = manager.getNodes().find((node) => node.id === NODE_ID)expect(getVariables(afterUserA!)).toEqual(['a', 'b'])internals.syncNodes(base, userB)- const finalNode = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)+ const finalNode = manager.getNodes().find((node) => node.id === NODE_ID)const finalVariables = getVariables(finalNode!)expect(finalVariables).toEqual(['a', 'c'])@@ -320,7 +320,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes(base, userA)internals.syncNodes(base, userB)- const finalNode = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)+ const finalNode = manager.getNodes().find((node) => node.id === NODE_ID)const finalVariable = getVariableObject(finalNode!, 'a')expect(finalVariable?.label).toBe('A from userB')@@ -355,7 +355,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes(base, userA)internals.syncNodes(base, userB)- const finalNode = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)+ const finalNode = manager.getNodes().find((node) => node.id === NODE_ID)const finalVariables = getVariables(finalNode!)expect(finalVariables).toEqual(['a', 'b'])expect(getVariableObject(finalNode!, 'b')).toBeDefined()@@ -387,7 +387,7 @@ describe('CollaborationManager syncNodes', () => {const updatedNode = createLLMNodeSnapshot(updatedTemplates)promptInternals.syncNodes([deepClone(baseNode)], [deepClone(updatedNode)])- const stored = (promptManager.getNodes() as Node[]).find((node) => node.id === LLM_NODE_ID)+ const stored = promptManager.getNodes().find((node) => node.id === LLM_NODE_ID)expect(stored).toBeDefined()const storedTemplates = getPromptTemplates(stored!)@@ -406,7 +406,7 @@ describe('CollaborationManager syncNodes', () => {promptInternals.syncNodes([deepClone(updatedNode)], [deepClone(editedNode)])- const final = (promptManager.getNodes() as Node[]).find((node) => node.id === LLM_NODE_ID)+ const final = promptManager.getNodes().find((node) => node.id === LLM_NODE_ID)const finalTemplates = getPromptTemplates(final!)expect(finalTemplates).toHaveLength(1)expect(finalTemplates[0]!.text).toBe('updated system prompt')@@ -431,7 +431,7 @@ describe('CollaborationManager syncNodes', () => {const updatedNode = createParameterExtractorNodeSnapshot(updatedParameters)parameterInternals.syncNodes([deepClone(baseNode)], [deepClone(updatedNode)])- const stored = (parameterManager.getNodes() as Node[]).find((node) => node.id === PARAM_NODE_ID)+ const stored = parameterManager.getNodes().find((node) => node.id === PARAM_NODE_ID)expect(stored).toBeDefined()expect(getParameters(stored!)).toEqual(updatedParameters)@@ -442,7 +442,7 @@ describe('CollaborationManager syncNodes', () => {parameterInternals.syncNodes([deepClone(updatedNode)], [deepClone(editedNode)])- const final = (parameterManager.getNodes() as Node[]).find((node) => node.id === PARAM_NODE_ID)+ const final = parameterManager.getNodes().find((node) => node.id === PARAM_NODE_ID)expect(getParameters(final!)).toEqual(editedParameters)})@@ -456,7 +456,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes([], [deepClone(emptyNode)])- const stored = (manager.getNodes() as Node[]).find((node) => node.id === 'empty-node')+ const stored = manager.getNodes().find((node) => node.id === 'empty-node')expect(stored).toBeDefined()expect(stored?.data).toEqual({})})@@ -536,7 +536,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes([], [deepClone(nodeWithPrivate)])- const stored = (manager.getNodes() as Node[]).find((node) => node.id === 'private-node')!+ const stored = manager.getNodes().find((node) => node.id === 'private-node')!const storedData = stored.data as CommonNodeType<{ _foo?: string }>expect(storedData._foo).toBeUndefined()expect(storedData._children).toEqual([{ nodeId: 'child-a', nodeType: BlockEnum.Start }])@@ -557,7 +557,7 @@ describe('CollaborationManager syncNodes', () => {internals.syncNodes([deepClone(baseNode)], [withoutVariables])- const stored = (manager.getNodes() as Node[]).find((node) => node.id === NODE_ID)!+ const stored = manager.getNodes().find((node) => node.id === NODE_ID)!const storedData = stored.data as CommonNodeType<{ variables?: WorkflowVariable[] }>expect(storedData.variables).toBeUndefined()})diff --git a/web/app/components/workflow/collaboration/core/collaboration-manager.ts b/web/app/components/workflow/collaboration/core/collaboration-manager.tsindex b9e36b72c11..cf7cd69365a 100644--- a/web/app/components/workflow/collaboration/core/collaboration-manager.ts+++ b/web/app/components/workflow/collaboration/core/collaboration-manager.ts@@ -1153,7 +1153,7 @@ export class CollaborationManager {this.sendCollaborationEvent({type: 'workflow_restore_intent',- data: data as unknown as Record<string, unknown>,+ data: data as Record<string, unknown>,timestamp: Date.now(),})}@@ -1163,7 +1163,7 @@ export class CollaborationManager {this.sendCollaborationEvent({type: 'workflow_restore_complete',- data: data as unknown as Record<string, unknown>,+ data: data as Record<string, unknown>,timestamp: Date.now(),})}diff --git a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.tsindex d2d5cb34224..e60de22fafb 100644--- a/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-checklist.spec.ts@@ -799,7 +799,7 @@ describe('useChecklist', () => {describe('useChecklistBeforePublish', () => {it('should reject an invalid legacy Agent instead of throwing when its metadata is hidden', async () => {const { nodes, edges } = buildLegacyAgentGraph()- rfState.nodes = nodes as unknown as typeof rfState.nodes+ rfState.nodes = nodesrfState.edges = edges as unknown as typeof rfState.edgesconst { result } = renderWorkflowHook(() => useChecklistBeforePublish())@@ -817,7 +817,7 @@ describe('useWorkflowRunValidation', () => {rfState.edges = edges as unknown as typeof rfState.edgesconst { result } = renderWorkflowHook(() => useWorkflowRunValidation(), {- initialStoreState: { nodes: nodes as Node[] },+ initialStoreState: { nodes },hooksStoreProps: {},})@@ -830,7 +830,7 @@ describe('useWorkflowRunValidation', () => {rfState.edges = edges as unknown as typeof rfState.edgesconst { result } = renderWorkflowHook(() => useWorkflowRunValidation(), {- initialStoreState: { nodes: nodes as Node[] },+ initialStoreState: { nodes },hooksStoreProps: {},})diff --git a/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts b/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.tsindex 00548868027..11678891a12 100644--- a/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts+++ b/web/app/components/workflow/hooks/__tests__/use-nodes-interactions.spec.ts@@ -157,7 +157,7 @@ describe('useNodesInteractions', () => {target: 'node-2',}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesruntimeNodesMetaDataMap.value = {}})@@ -374,7 +374,7 @@ describe('useNodesInteractions', () => {}),]currentEdges = []- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result } = renderWorkflowHook(() => useNodesInteractions(), {@@ -422,7 +422,7 @@ describe('useNodesInteractions', () => {target: 'to-node',}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -508,7 +508,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = []rfState.setNodes.mockImplementation((nextNodes) => {rfState.nodes = nextNodes@@ -593,7 +593,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = []rfState.setNodes.mockImplementation((nextNodes) => {rfState.nodes = nextNodes@@ -665,7 +665,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesconst { result } = renderWorkflowHook(() => useNodesInteractions(), {historyStore: {@@ -705,7 +705,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesconst { result } = renderWorkflowHook(() => useNodesInteractions(), {historyStore: {@@ -750,7 +750,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {historyStore: {@@ -794,7 +794,7 @@ describe('useNodesInteractions', () => {target: 'node-b',}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result } = renderWorkflowHook(() => useNodesInteractions(), {@@ -843,7 +843,7 @@ describe('useNodesInteractions', () => {target: 'drag-node-2',}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -867,7 +867,7 @@ describe('useNodesInteractions', () => {result.current.handleNodeDrag({ stopPropagation: vi.fn() } as never,currentNodes[0] as Node,- currentNodes as Node[],+ currentNodes,)result.current.handleNodeSelect('drag-node-2')result.current.handleNodeConnect({@@ -918,7 +918,7 @@ describe('useNodesInteractions', () => {},}),]- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = []const { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -1068,7 +1068,7 @@ describe('useNodesInteractions', () => {}),]currentEdges = []- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -1126,7 +1126,7 @@ describe('useNodesInteractions', () => {}),]currentEdges = []- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -1216,7 +1216,7 @@ describe('useNodesInteractions', () => {}),]currentEdges = []- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {@@ -1309,7 +1309,7 @@ describe('useNodesInteractions', () => {}),]currentEdges = []- rfState.nodes = currentNodes as unknown as typeof rfState.nodes+ rfState.nodes = currentNodesrfState.edges = currentEdges as unknown as typeof rfState.edgesconst { result, store } = renderWorkflowHook(() => useNodesInteractions(), {diff --git a/web/app/components/workflow/hooks/use-checklist.ts b/web/app/components/workflow/hooks/use-checklist.tsindex 31a097ec45b..8b3167adc1f 100644--- a/web/app/components/workflow/hooks/use-checklist.ts+++ b/web/app/components/workflow/hooks/use-checklist.ts@@ -115,8 +115,7 @@ const resolveNodeValidator = (const validator = nodesExtraData?.[getNodeCatalogType(data)]?.checkValidif (validator) return validator- if (data.type === BlockEnum.Agent && !isAgentV2NodeData(data))- return AgentDefault.checkValid as NodeValidator+ if (data.type === BlockEnum.Agent && !isAgentV2NodeData(data)) return AgentDefault.checkValid}const START_NODE_TYPES: BlockEnum[] = [@@ -548,9 +547,7 @@ export const useChecklist = (nodes: Node[], edges: Edge[]) => {// Check for start nodes (including triggers)if (shouldCheckStartNode) {- const startNodesFiltered = nodes.filter((node) =>- START_NODE_TYPES.includes(node.data.type as BlockEnum),- )+ const startNodesFiltered = nodes.filter((node) => START_NODE_TYPES.includes(node.data.type))const hasStartPlaceholderNode = nodes.some((node) => node.data.type === BlockEnum.StartPlaceholder,)diff --git a/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx b/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsxindex b30ced67503..9ae6f2169db 100644--- a/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx+++ b/web/app/components/workflow/hooks/use-dynamic-test-run-options.tsx@@ -82,7 +82,7 @@ export const useDynamicTestRunOptions = (): TestRunOptions => {}if (!userInput) {- const startNode = getWorkflowEntryNode(nodes as any[])+ const startNode = getWorkflowEntryNode(nodes)if (startNode && startNode.data?.type === BlockEnum.Start) {userInput = {id: startNode.id,diff --git a/web/app/components/workflow/hooks/use-helpline.ts b/web/app/components/workflow/hooks/use-helpline.tsindex b8cb4d55965..3703834087f 100644--- a/web/app/components/workflow/hooks/use-helpline.ts+++ b/web/app/components/workflow/hooks/use-helpline.ts@@ -155,7 +155,7 @@ export const useHelpline = () => {// Check if a node is an entry node (Start or Trigger)const isEntryNode = useCallback((node: Node): boolean => {- return isTriggerNode(node.data.type as any) || node.data.type === BlockEnum.Start+ return isTriggerNode(node.data.type) || node.data.type === BlockEnum.Start}, [])// Get the actual alignment position of a node (accounting for wrapper offset)diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.tsindex ee289b8ae3a..fec73d34681 100644--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts@@ -274,14 +274,13 @@ export const useNodesInteractions = () => {// Check if current dragging node is an entry nodeconst isCurrentEntryNode =- isTriggerNode(node.data.type as BlockEnum) || node.data.type === BlockEnum.Start+ isTriggerNode(node.data.type) || node.data.type === BlockEnum.Start// X-axis alignment with offset considerationif (showVerticalHelpLineNodesLength > 0) {const targetNode = showVerticalHelpLineNodes[0]const isTargetEntryNode =- isTriggerNode(targetNode!.data.type as BlockEnum) ||- targetNode!.data.type === BlockEnum.Start+ isTriggerNode(targetNode!.data.type) || targetNode!.data.type === BlockEnum.Start// Calculate the wrapper position needed to align the inner nodes// Target inner position = target.position + target.offset@@ -303,8 +302,7 @@ export const useNodesInteractions = () => {if (showHorizontalHelpLineNodesLength > 0) {const targetNode = showHorizontalHelpLineNodes[0]const isTargetEntryNode =- isTriggerNode(targetNode!.data.type as BlockEnum) ||- targetNode!.data.type === BlockEnum.Start+ isTriggerNode(targetNode!.data.type) || targetNode!.data.type === BlockEnum.Startconst targetOffset = isTargetEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.y : 0const currentOffset = isCurrentEntryNode ? ENTRY_NODE_WRAPPER_OFFSET.y : 0diff --git a/web/app/components/workflow/node-actions-menu/change-block-popup.tsx b/web/app/components/workflow/node-actions-menu/change-block-popup.tsxindex 292394597a2..599fa8e125c 100644--- a/web/app/components/workflow/node-actions-menu/change-block-popup.tsx+++ b/web/app/components/workflow/node-actions-menu/change-block-popup.tsx@@ -47,8 +47,7 @@ export function ChangeBlockPopup({resourceKind !== 'knowledge-pipeline' &&(!isChatflow || nodeData.type === BlockEnum.Start || !hasStartNode)const ignoreNodeIds = useMemo(() => {- if (isTriggerNode(nodeData.type as BlockEnum) || nodeData.type === BlockEnum.Start)- return [nodeId]+ if (isTriggerNode(nodeData.type) || nodeData.type === BlockEnum.Start) return [nodeId]return undefined}, [nodeData.type, nodeId])const allowStartNodeSelection = !hasStartNodediff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/helpers.spec.ts b/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/helpers.spec.tsindex 599159977f2..81406be3223 100644--- a/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/helpers.spec.ts+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/__tests__/helpers.spec.ts@@ -15,8 +15,7 @@ import {type FormArg = Parameters<typeof buildSubmitData>[0][number]describe('before-run-form helpers', () => {- const createValues = (values: Record<string, unknown>) =>- values as unknown as Record<string, string>+ const createValues = (values: Record<string, unknown>) => values as Record<string, string>const createInput = (input: Partial<InputVar>): InputVar => ({variable: 'field',label: 'Field',diff --git a/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts b/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.tsindex f9315de08ff..923ac61aa7d 100644--- a/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts+++ b/web/app/components/workflow/nodes/_base/components/before-run-form/helpers.ts@@ -16,7 +16,7 @@ export function formatValue(value: unknown, type: InputVarType) {if (type === InputVarType.multiFiles) return getProcessedFiles(value as FileEntity[])if (type === InputVarType.singleFile) {- if (Array.isArray(value)) return getProcessedFiles(value as FileEntity[])+ if (Array.isArray(value)) return getProcessedFiles(value)if (!value) return undefinedreturn getProcessedFiles([value as FileEntity])[0]}diff --git a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsxindex a261983659c..a243cd7c3f7 100644--- a/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx+++ b/web/app/components/workflow/nodes/_base/components/error-handle/error-handle-on-panel.tsx@@ -1,5 +1,5 @@import type { DefaultValueForm } from './types'-import type { CommonNodeType, Node } from '@/app/components/workflow/types'+import type { Node } from '@/app/components/workflow/types'import { Infotip, InfotipContent, InfotipTrigger } from '@langgenius/dify-ui/infotip'import { useId } from 'react'import { useTranslation } from 'react-i18next'@@ -30,11 +30,11 @@ const ErrorHandle = ({ id, data }: ErrorHandleProps) => {const { handleFormChange } = useDefaultValue(id)const handleTypeChange = (value: ErrorHandleTypeEnum) => {- handleErrorHandleTypeChange(value, data as CommonNodeType)+ handleErrorHandleTypeChange(value, data)}const handleDefaultValueChange = (value: DefaultValueForm) => {- handleFormChange(value, data as CommonNodeType)+ handleFormChange(value, data)}return (diff --git a/web/app/components/workflow/nodes/_base/components/form-input-item.helpers.ts b/web/app/components/workflow/nodes/_base/components/form-input-item.helpers.tsindex 81b6e6b75ec..1afeaf4c927 100644--- a/web/app/components/workflow/nodes/_base/components/form-input-item.helpers.ts+++ b/web/app/components/workflow/nodes/_base/components/form-input-item.helpers.ts@@ -247,9 +247,9 @@ export const getCheckboxListValue = () => {let current: string[] = []- if (Array.isArray(currentValue)) current = currentValue as string[]+ if (Array.isArray(currentValue)) current = currentValueelse if (typeof currentValue === 'string') current = [currentValue]- else if (Array.isArray(defaultValue)) current = defaultValue as string[]+ else if (Array.isArray(defaultValue)) current = defaultValueconst allowedValues = new Set(availableOptions.map((option) => option.value))return current.filter((item) => allowedValues.has(item))diff --git a/web/app/components/workflow/nodes/_base/components/next-step/index.tsx b/web/app/components/workflow/nodes/_base/components/next-step/index.tsxindex df80ba801cf..47eee4cd2b9 100644--- a/web/app/components/workflow/nodes/_base/components/next-step/index.tsx+++ b/web/app/components/workflow/nodes/_base/components/next-step/index.tsx@@ -41,7 +41,7 @@ const NextStep = ({ selectedNode }: NextStepProps) => {})),isEqual,)- const outgoers = getOutgoers(selectedNode as Node, nodes as Node[], edges)+ const outgoers = getOutgoers(selectedNode, nodes as Node[], edges)const connectedEdges = getConnectedEdges([selectedNode] as Node[], edges).filter((edge) => edge.source === selectedNode!.id,)diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.tsindex 85a655a32b8..19e8c884a89 100644--- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts+++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts@@ -638,7 +638,7 @@ const formatItem = (res.vars = data.ragVariables.map((ragVar: RAGPipelineVariable) => {return {variable: `rag.shared.${ragVar.variable}`,- type: inputVarTypeToVarType(ragVar.type as any),+ type: inputVarTypeToVarType(ragVar.type),des: ragVar.label,isRagVariable: true,}@@ -824,7 +824,7 @@ export const toNodeOutputVars = (ragVariablesInDataSource.map((ragVariable: RAGPipelineVariable) => {return {variable: `rag.${node.id}.${ragVariable.variable}`,- type: inputVarTypeToVarType(ragVariable.type as any),+ type: inputVarTypeToVarType(ragVariable.type),description: ragVariable.label,isRagVariable: true,} as Var@@ -1043,7 +1043,7 @@ export const getVarType = ({let curr: any = targetVar.varsif (isInStartNodeSysVar || isEnv || isChatVar || isSharedRagVariable || isGlobal) {- return curr.find((v: any) => v.variable === (valueSelector as ValueSelector).join('.'))?.type+ return curr.find((v: any) => v.variable === valueSelector.join('.'))?.type} else {const targetVar = curr.find((v: any) => {if (isInNodeRagVariable) return v.variable === valueSelector.join('.')@@ -1060,7 +1060,7 @@ export const getVarType = ({return preferSchemaType && targetVar.schemaType ? targetVar.schemaType : VarType.object}let currProperties = targetVar.children.schema- ;(valueSelector as ValueSelector).slice(2).forEach((key, i) => {+ valueSelector.slice(2).forEach((key, i) => {const isLast = i === valueSelector.length - 3if (!currProperties) return@@ -1070,7 +1070,7 @@ export const getVarType = ({return type}- ;(valueSelector as ValueSelector).slice(1).forEach((key, i) => {+ valueSelector.slice(1).forEach((key, i) => {const isLast = i === valueSelector.length - 2if (Array.isArray(curr)) curr = curr?.find((v: any) => v.variable === key)@@ -1326,7 +1326,7 @@ export const getNodeUsedVars = (node: Node, { forExecution = false } = {}): Valu}case BlockEnum.Agent: {if (isAgentV2NodeData(data)) {- const payload = data as AgentV2NodeType+ const payload = datares = matchNotSystemVars([payload.agent_task || '',...(!forExecution || payload.agent_output_routes?.enabled@@ -1724,7 +1724,7 @@ export const updateNodeVars = (}case BlockEnum.Agent: {if (isAgentV2NodeData(data)) {- const payload = data as AgentV2NodeType+ const payload = datapayload.agent_task = replaceOldVarInText(payload.agent_task || '',oldVarSelector,diff --git a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsxindex 3c514584822..03f74dd0dfd 100644--- a/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx+++ b/web/app/components/workflow/nodes/_base/components/variable/var-reference-picker.trigger.tsx@@ -156,10 +156,10 @@ const VarReferencePickerTrigger: FC<Props> = ({</div><divclassName="mx-0.5 truncate text-xs font-medium text-text-secondary"- title={outputVarNode?.title as string | undefined}+ title={outputVarNode?.title}style={{ maxWidth: maxNodeNameWidth }}>- {outputVarNode?.title as string | undefined}+ {outputVarNode?.title}</div><span aria-hidden className="mr-0.5 i-custom-public-common-line-3 h-3 w-1.25" /></div>diff --git a/web/app/components/workflow/nodes/_base/hooks/snippet-input-field-vars.ts b/web/app/components/workflow/nodes/_base/hooks/snippet-input-field-vars.tsindex 4b2a82f653d..43c3bad4176 100644--- a/web/app/components/workflow/nodes/_base/hooks/snippet-input-field-vars.ts+++ b/web/app/components/workflow/nodes/_base/hooks/snippet-input-field-vars.ts@@ -18,7 +18,7 @@ export const filterSnippetSystemVars = (availableVars: NodeOutPutVar[], isSnippe.filter((nodeVar) => nodeVar.vars.length > 0)}-const toWorkflowInputType = (type: SnippetInputField['type']) => type as unknown as InputVarType+const toWorkflowInputType = (type: SnippetInputField['type']) => type as InputVarTypeconst buildSnippetInputFieldNode = (fields: SnippetInputField[],@@ -64,7 +64,7 @@ const buildSnippetInputFieldVars = (.filter((field) => !!field.variable).map((field) => ({variable: field.variable,- type: inputVarTypeToVarType(field.type as PipelineInputVarType),+ type: inputVarTypeToVarType(field.type),isParagraph: field.type === PipelineInputVarType.paragraph,isSelect: field.type === PipelineInputVarType.select,options: field.options,diff --git a/web/app/components/workflow/nodes/agent-v2/__tests__/hooks.spec.tsx b/web/app/components/workflow/nodes/agent-v2/__tests__/hooks.spec.tsxindex f788fa77f5f..07effe9afee 100644--- a/web/app/components/workflow/nodes/agent-v2/__tests__/hooks.spec.tsx+++ b/web/app/components/workflow/nodes/agent-v2/__tests__/hooks.spec.tsx@@ -549,7 +549,7 @@ describe('useCreateInlineAgentBinding', () => {mockComposerMutationFn.mockImplementationOnce(async (_variables) =>new Promise((resolve) => {- resolveComposerState = resolve as typeof resolveComposerState+ resolveComposerState = resolve}),)const onSuccess = vi.fn()diff --git a/web/app/components/workflow/nodes/end/node.tsx b/web/app/components/workflow/nodes/end/node.tsxindex c0ca2c06455..cd964152d2d 100644--- a/web/app/components/workflow/nodes/end/node.tsx+++ b/web/app/components/workflow/nodes/end/node.tsx@@ -1,6 +1,6 @@import type { FC } from 'react'import type { EndNodeType } from './types'-import type { NodeProps, Variable } from '@/app/components/workflow/types'+import type { NodeProps } from '@/app/components/workflow/types'import { useAtomValue } from 'jotai'import * as React from 'react'import { isChatflowAtom } from '@/app/components/workflow/editor-resource/state'@@ -24,9 +24,7 @@ const Node: FC<NodeProps<EndNodeType>> = ({ id, data }) => {}const { outputs } = data- const filteredOutputs = (outputs as Variable[]).filter(- ({ value_selector }) => value_selector.length > 0,- )+ const filteredOutputs = outputs.filter(({ value_selector }) => value_selector.length > 0)if (!filteredOutputs.length) return nulldiff --git a/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx b/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsxindex c90092a6918..7337906ea28 100644--- a/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx+++ b/web/app/components/workflow/nodes/human-input/__tests__/human-input.spec.tsx@@ -172,7 +172,7 @@ describe('DSL Import with Human Input Node', () => {const nodes = [startNode, humanInputNode]const edges = [createEdge('inset-s-1', 'human-input-1')]- const result = preprocessNodesAndEdges(nodes as Node[], edges as Edge[])+ const result = preprocessNodesAndEdges(nodes, edges)expect(result.nodes).toHaveLength(2)expect(result.edges).toHaveLength(1)@@ -184,7 +184,7 @@ describe('DSL Import with Human Input Node', () => {const humanInputNode = createHumanInputNode()const nodes = [humanInputNode]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])// No extra iteration/loop start nodes should be injectedexpect(result.nodes).toHaveLength(1)@@ -200,7 +200,7 @@ describe('DSL Import with Human Input Node', () => {const nodes = [startNode, humanInputNode]const edges = [createEdge('inset-s-1', 'human-input-1')]- const result = initialNodes(nodes as Node[], edges as Edge[])+ const result = initialNodes(nodes, edges)const processedHumanInput = result.find((n) => n.id === 'human-input-1')expect(processedHumanInput).toBeDefined()@@ -214,7 +214,7 @@ describe('DSL Import with Human Input Node', () => {const humanInputNode = createHumanInputNode()const nodes = [humanInputNode]- const result = initialNodes(nodes as Node[], [])+ const result = initialNodes(nodes, [])const processed = result[0]const nodeData = processed!.data as HumanInputNodeType@@ -602,11 +602,11 @@ describe('DSL Import with Human Input Node', () => {createEdge('human-input-1', 'inset-e-1', 'approve', 'target'),]- const processed = preprocessNodesAndEdges(nodes as Node[], edges as Edge[])+ const processed = preprocessNodesAndEdges(nodes, edges)expect(processed.nodes).toHaveLength(3)expect(processed.edges).toHaveLength(2)- const initialized = initialNodes(nodes as Node[], edges as Edge[])+ const initialized = initialNodes(nodes, edges)expect(initialized).toHaveLength(3)// All node types should be preserved@@ -639,7 +639,7 @@ describe('DSL Import with Human Input Node', () => {createEdge('human-input-1', 'reject-end', 'reject', 'target'),]- const initialized = initialNodes(nodes as Node[], edges as Edge[])+ const initialized = initialNodes(nodes, edges)expect(initialized).toHaveLength(4)// Human input node should still have correct datadiff --git a/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.helpers.spec.ts b/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.helpers.spec.tsindex 4e85e77718c..b120b23d1ab 100644--- a/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.helpers.spec.ts+++ b/web/app/components/workflow/nodes/iteration/__tests__/use-interactions.helpers.spec.ts@@ -25,12 +25,10 @@ describe('iteration interaction helpers', () => {createNode({ id: 'a', position: { x: 20, y: 10 }, width: 80, height: 40 }),createNode({ id: 'b', position: { x: 120, y: 60 }, width: 50, height: 30 }),]- const bounds = getIterationContainerBounds(children as Node[])+ const bounds = getIterationContainerBounds(children)expect(bounds.rightNode?.id).toBe('b')expect(bounds.bottomNode?.id).toBe('b')- expect(- getIterationContainerResize(createNode({ width: 120, height: 80 }) as Node, bounds),- ).toEqual({+ expect(getIterationContainerResize(createNode({ width: 120, height: 80 }), bounds)).toEqual({width: 186,height: 110,})@@ -42,7 +40,7 @@ describe('iteration interaction helpers', () => {height: 40,data: { isInIteration: true },}),- createNode({ width: 200, height: 180 }) as Node,+ createNode({ width: 200, height: 180 }),),).toEqual({ x: 16, y: 120 })expect(@@ -53,7 +51,7 @@ describe('iteration interaction helpers', () => {height: 30,data: { isInIteration: true },}),- createNode({ width: 200, height: 180 }) as Node,+ createNode({ width: 200, height: 180 }),),).toEqual({ x: 144, y: 65 })})@@ -76,9 +74,7 @@ describe('iteration interaction helpers', () => {it('keeps bounds, resize and positions empty when no container restriction applies', () => {expect(getIterationContainerBounds([])).toEqual({})- expect(- getIterationContainerResize(createNode({ width: 300, height: 240 }) as Node, {}),- ).toEqual({+ expect(getIterationContainerResize(createNode({ width: 300, height: 240 }), {})).toEqual({width: undefined,height: undefined,})@@ -88,7 +84,7 @@ describe('iteration interaction helpers', () => {expect(getRestrictedIterationPosition(createNode({ data: { isInIteration: false } }),- createNode({ width: 200, height: 180 }) as Node,+ createNode({ width: 200, height: 180 }),),).toEqual({ x: undefined, y: undefined })})diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/panel.spec.tsxindex b50ba5582cb..9549e5d4745 100644--- a/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/knowledge-retrieval/__tests__/panel.spec.tsx@@ -367,7 +367,7 @@ describe('knowledge-retrieval/panel', () => {beforeEach(() => {vi.clearAllMocks()- mockUseConfig.mockReturnValue(createConfigResult() as ReturnType<typeof useConfig>)+ mockUseConfig.mockReturnValue(createConfigResult())})it('wires panel actions and passes the intersected metadata list to metadata filters', async () => {@@ -439,7 +439,7 @@ describe('knowledge-retrieval/panel', () => {createConfigResult({readOnly: true,showImageQueryVarSelector: false,- }) as ReturnType<typeof useConfig>,+ }),)render(<Panel id="knowledge-node" data={createData()} panelProps={panelProps} />)diff --git a/web/app/components/workflow/nodes/list-operator/components/__tests__/filter-condition.spec.tsx b/web/app/components/workflow/nodes/list-operator/components/__tests__/filter-condition.spec.tsxindex 48b1aec5e31..d61381b7133 100644--- a/web/app/components/workflow/nodes/list-operator/components/__tests__/filter-condition.spec.tsx+++ b/web/app/components/workflow/nodes/list-operator/components/__tests__/filter-condition.spec.tsx@@ -172,7 +172,7 @@ describe('FilterCondition', () => {value: 'draft next',})- const config = mockUseAvailableVarList.mock.calls[0]?.[1] as unknown as {+ const config = mockUseAvailableVarList.mock.calls[0]?.[1] as {filterVar: (varPayload: { type: VarType }) => boolean}expect(config.filterVar({ type: VarType.string })).toBe(true)diff --git a/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts b/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.tsindex 0bba3420aeb..592820157eb 100644--- a/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts+++ b/web/app/components/workflow/nodes/llm/__tests__/use-config.spec.ts@@ -205,10 +205,8 @@ describe('llm/use-config', () => {setInputs,appendDefaultPromptConfig,} as ReturnType<typeof useLLMInputManager>)- mockUseLLMPromptConfig.mockReturnValue(promptConfig as ReturnType<typeof useLLMPromptConfig>)- mockUseLLMStructuredOutputConfig.mockReturnValue(- structuredOutputConfig as ReturnType<typeof useLLMStructuredOutputConfig>,- )+ mockUseLLMPromptConfig.mockReturnValue(promptConfig)+ mockUseLLMStructuredOutputConfig.mockReturnValue(structuredOutputConfig)})it('composes the helper hooks, forwards filterVar to available vars, and updates completion params', () => {diff --git a/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts b/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.tsindex 66d7009c98d..45ba53352f6 100644--- a/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts+++ b/web/app/components/workflow/nodes/llm/hooks/__tests__/use-llm-prompt-config.spec.ts@@ -57,7 +57,7 @@ describe('use-llm-prompt-config', () => {jinja2_text: '{{ city }}',},],- prompt_config: undefined as unknown as LLMNodeType['prompt_config'],+ prompt_config: undefined as LLMNodeType['prompt_config'],}),} as MutableRefObject<LLMNodeType>const handleMissingConfigInputs = createSetInputs(missingConfigRef)diff --git a/web/app/components/workflow/nodes/loop/__tests__/use-interactions.helpers.spec.ts b/web/app/components/workflow/nodes/loop/__tests__/use-interactions.helpers.spec.tsindex e3c31856538..a08f239d5ea 100644--- a/web/app/components/workflow/nodes/loop/__tests__/use-interactions.helpers.spec.ts+++ b/web/app/components/workflow/nodes/loop/__tests__/use-interactions.helpers.spec.ts@@ -25,10 +25,10 @@ describe('loop interaction helpers', () => {createNode({ id: 'b', position: { x: 120, y: 60 }, width: 50, height: 30 }),]- const bounds = getContainerBounds(children as Node[])+ const bounds = getContainerBounds(children)expect(bounds.rightNode?.id).toBe('b')expect(bounds.bottomNode?.id).toBe('b')- expect(getContainerResize(createNode({ width: 120, height: 80 }) as Node, bounds)).toEqual({+ expect(getContainerResize(createNode({ width: 120, height: 80 }), bounds)).toEqual({width: 186,height: 110,})@@ -40,9 +40,10 @@ describe('loop interaction helpers', () => {it('restricts loop positions only for loop children and filters loop-start nodes', () => {const parent = createNode({ id: 'parent', width: 200, height: 180 })- expect(- getRestrictedLoopPosition(createNode({ data: { isInLoop: false } }) as Node, parent as Node),- ).toEqual({ x: undefined, y: undefined })+ expect(getRestrictedLoopPosition(createNode({ data: { isInLoop: false } }), parent)).toEqual({+ x: undefined,+ y: undefined,+ })expect(getRestrictedLoopPosition(createNode({@@ -51,7 +52,7 @@ describe('loop interaction helpers', () => {height: 40,data: { isInLoop: true },}),- parent as Node,+ parent,),).toEqual({ x: 16, y: 120 })expect(@@ -62,7 +63,7 @@ describe('loop interaction helpers', () => {height: 30,data: { isInLoop: true },}),- parent as Node,+ parent,),).toEqual({ x: 144, y: 65 })expect(diff --git a/web/app/components/workflow/nodes/start/use-config.ts b/web/app/components/workflow/nodes/start/use-config.tsindex 011d3f8e3bd..5297a527d6f 100644--- a/web/app/components/workflow/nodes/start/use-config.ts+++ b/web/app/components/workflow/nodes/start/use-config.ts@@ -40,7 +40,7 @@ const useConfig = (id: string, payload: StartNodeType) => {if (isVarUsedInNodes([id, moreInfo?.payload?.payload?.beforeKey || ''])) {setIsShowRemoveVarConfirm(true)setRemovedVar([id, moreInfo?.payload?.payload?.beforeKey || ''])- setRemoveIndex(moreInfo?.index as number)+ setRemoveIndex(moreInfo?.index)return}}diff --git a/web/app/components/workflow/nodes/trigger-plugin/default.ts b/web/app/components/workflow/nodes/trigger-plugin/default.tsindex b6c8c04f848..61a30c45384 100644--- a/web/app/components/workflow/nodes/trigger-plugin/default.ts+++ b/web/app/components/workflow/nodes/trigger-plugin/default.ts@@ -124,7 +124,7 @@ const toFieldType = (normalizedType: string | undefined, schemaType?: string): Tconst toArrayItemType = (type: Type): Exclude<Type, typeof Type.array> => {if (type === Type.array) return Type.object- return type as Exclude<Type, typeof Type.array>+ return type}const convertJsonSchemaToField = (diff --git a/web/app/components/workflow/nodes/trigger-plugin/use-config.ts b/web/app/components/workflow/nodes/trigger-plugin/use-config.tsindex 1e24c6e2921..0cbed38dd9e 100644--- a/web/app/components/workflow/nodes/trigger-plugin/use-config.ts+++ b/web/app/components/workflow/nodes/trigger-plugin/use-config.ts@@ -75,11 +75,11 @@ const useConfig = (id: string, payload: PluginTriggerNodeType) => {} = inputsconst event_parameters = useMemo(- () => normalizeEventParameters(rawEventParameters as PluginTriggerVarInputs),+ () => normalizeEventParameters(rawEventParameters),[rawEventParameters],)const legacy_config_parameters = useMemo(- () => normalizeEventParameters(config as PluginTriggerVarInputs, { allowScalars: true }),+ () => normalizeEventParameters(config, { allowScalars: true }),[config],)diff --git a/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx b/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsxindex d2a0d5a4a41..87e04efc084 100644--- a/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx+++ b/web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx@@ -240,7 +240,7 @@ describe('TriggerSchedulePanel', () => {handleOnMinuteChange,})- const { rerender } = renderPanel('node-6', createData({ frequency: undefined }) as any)+ const { rerender } = renderPanel('node-6', createData({ frequency: undefined }))expect(screen.getByRole('button', { name: 'daily' })).toBeInTheDocument()expect(screen.getByRole('button', { name: /11:30 AM/ })).toBeInTheDocument()diff --git a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.tsindex 96a8e73c40b..03e3649784c 100644--- a/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts+++ b/web/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator.ts@@ -237,7 +237,7 @@ export const getNextExecutionTimes = (data: ScheduleTriggerNodeType, count: numbif (selectedDay === 'last') {targetDay = daysInMonth} else {- const dayNumber = selectedDay as number+ const dayNumber = selectedDayif (dayNumber > daysInMonth) continuetargetDay = dayNumberdiff --git a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsxindex bdb723b774a..911ac9ae82c 100644--- a/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx+++ b/web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx@@ -81,7 +81,7 @@ const ParameterTable: FC<ParameterTableProps> = ({const isOctetStream = (contentType || '').toLowerCase() === 'application/octet-stream'const normalized = data- .filter((row) => typeof row.key === 'string' && (row.key as string).trim() !== '')+ .filter((row) => typeof row.key === 'string' && row.key.trim() !== '').map((row) => ({name: String(row.key),type: isTextPlaindiff --git a/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx b/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsxindex 89050828393..3b84e22d48e 100644--- a/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx+++ b/web/app/components/workflow/nodes/variable-assigner/components/var-group-item.tsx@@ -65,12 +65,7 @@ const VarGroupItem: FC<Props> = ({(newList: ValueSelector[], changedItem?: ValueSelector) => {if (changedItem) {const chosenVariables = payload.variables- if (- chosenVariables.some(- (item) => item.join('.') === (changedItem as ValueSelector).join('.'),- )- )- return+ if (chosenVariables.some((item) => item.join('.') === changedItem.join('.'))) return}const newPayload = produce(payload, (draft) => {diff --git a/web/app/components/workflow/nodes/variable-assigner/hooks.ts b/web/app/components/workflow/nodes/variable-assigner/hooks.tsindex 5097c94d6ec..d506efd218b 100644--- a/web/app/components/workflow/nodes/variable-assigner/hooks.ts+++ b/web/app/components/workflow/nodes/variable-assigner/hooks.ts@@ -35,9 +35,7 @@ export const useVariableAssigner = () => {(group: VarGroupItem & { groupId: string }) => {if (group.groupId === groupId &&- !group.variables.some(- (item) => item.join('.') === (value as ValueSelector).join('.'),- )+ !group.variables.some((item) => item.join('.') === value.join('.'))) {return {...group,@@ -51,10 +49,7 @@ export const useVariableAssigner = () => {},}} else {- if (- node.data.variables.some((item) => item.join('.') === (value as ValueSelector).join('.'))- )- return+ if (node.data.variables.some((item) => item.join('.') === value.join('.'))) returnpayload = {variables: [...node.data.variables, value],output_type: varDetail.type,diff --git a/web/app/components/workflow/operator/__tests__/index.spec.tsx b/web/app/components/workflow/operator/__tests__/index.spec.tsxindex 16d29a92761..5cc510c5eb3 100644--- a/web/app/components/workflow/operator/__tests__/index.spec.tsx+++ b/web/app/components/workflow/operator/__tests__/index.spec.tsx@@ -93,7 +93,7 @@ describe('Operator', () => {beforeEach(() => {vi.clearAllMocks()resizeObserverCallback = undefined- vi.stubGlobal('ResizeObserver', MockResizeObserver as unknown as typeof ResizeObserver)+ vi.stubGlobal('ResizeObserver', MockResizeObserver)})afterEach(() => {diff --git a/web/app/components/workflow/panel/__tests__/index.spec.tsx b/web/app/components/workflow/panel/__tests__/index.spec.tsxindex fc79d1ab971..0d5fcffb0b9 100644--- a/web/app/components/workflow/panel/__tests__/index.spec.tsx+++ b/web/app/components/workflow/panel/__tests__/index.spec.tsx@@ -55,7 +55,7 @@ class MockResizeObserver {observe = vi.fn(() => {if (!mockResizeModes.length) return- this.callback(mockResizeModes.map(createResizeEntry), this as unknown as ResizeObserver)+ this.callback(mockResizeModes.map(createResizeEntry), this)})disconnect = vi.fn()@@ -242,7 +242,7 @@ describe('Panel', () => {act(() => {mockResizeObservers.forEach((observer) => {- observer.callback([createResizeEntry('borderBox')], observer as unknown as ResizeObserver)+ observer.callback([createResizeEntry('borderBox')], observer)})})@@ -256,7 +256,7 @@ describe('Panel', () => {act(() => {mockResizeObservers.forEach((observer) => {- observer.callback([createResizeEntry('contentRect')], observer as unknown as ResizeObserver)+ observer.callback([createResizeEntry('contentRect')], observer)})})@@ -270,7 +270,7 @@ describe('Panel', () => {act(() => {mockResizeObservers.forEach((observer) => {- observer.callback([createResizeEntry('fallback')], observer as unknown as ResizeObserver)+ observer.callback([createResizeEntry('fallback')], observer)})})diff --git a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.tsindex d5e786f029d..8e6f188adbe 100644--- a/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts+++ b/web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts@@ -1,4 +1,3 @@-import type { ChatItemInTree } from '@/app/components/base/chat/types'import { renderEditorHook as renderHook } from '@/app/components/workflow/editor-resource/__tests__/render'import { useChat } from '../../hooks'@@ -156,13 +155,10 @@ describe('workflow debug useChat – opening statement stability', () => {},]- const { result, rerender } = renderHook(- ({ cfg }) => useChat(cfg, undefined, prevChatTree as ChatItemInTree[]),- {- resource: { kind: 'app', appId: 'app-1', mode: 'workflow' },- initialProps: { cfg: config },- },- )+ const { result, rerender } = renderHook(({ cfg }) => useChat(cfg, undefined, prevChatTree), {+ resource: { kind: 'app', appId: 'app-1', mode: 'workflow' },+ initialProps: { cfg: config },+ })const openerBefore = result.current.chatList[0]expect(openerBefore!.content).toBe('Updated welcome')diff --git a/web/app/components/workflow/panel/debug-and-preview/hooks.ts b/web/app/components/workflow/panel/debug-and-preview/hooks.tsindex d044af79fb8..3f67e3ca113 100644--- a/web/app/components/workflow/panel/debug-and-preview/hooks.ts+++ b/web/app/components/workflow/panel/debug-and-preview/hooks.ts@@ -908,7 +908,7 @@ export const useChat = ()})if (currentIndex > -1)- responseItem.workflowProcess.tracing[currentIndex] = nodeFinishedData as any+ responseItem.workflowProcess.tracing[currentIndex] = nodeFinishedData})},onLoopStart: ({ data: loopStartedData }) => {diff --git a/web/app/components/workflow/store/__tests__/trigger-status.spec.ts b/web/app/components/workflow/store/__tests__/trigger-status.spec.tsindex 56ef6345471..bd17570dba1 100644--- a/web/app/components/workflow/store/__tests__/trigger-status.spec.ts+++ b/web/app/components/workflow/store/__tests__/trigger-status.spec.ts@@ -280,7 +280,7 @@ describe('useTriggerStatusStore', () => {act(() => {specialNodeIds.forEach((nodeId, index) => {const status = index % 2 === 0 ? 'enabled' : 'disabled'- result.current.setTriggerStatus(nodeId, status as EntryNodeStatus)+ result.current.setTriggerStatus(nodeId, status)})})diff --git a/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts b/web/app/components/workflow/utils/__tests__/workflow-init.spec.tsindex 3144cae6eab..9cdcc9a9587 100644--- a/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts+++ b/web/app/components/workflow/utils/__tests__/workflow-init.spec.ts@@ -58,7 +58,7 @@ describe('preprocessNodesAndEdges', () => {const nodes = [createNode({ id: 'iter-1', data: { type: BlockEnum.Iteration, title: '', desc: '' } }),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const startNodes = result.nodes.filter((n) => n.data.type === BlockEnum.IterationStart)expect(startNodes).toHaveLength(1)expect(startNodes[0]!.parentId).toBe('iter-1')@@ -72,7 +72,7 @@ describe('preprocessNodesAndEdges', () => {}),createNode({ id: 'some-node', data: { type: BlockEnum.Code, title: '', desc: '' } }),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const startNodes = result.nodes.filter((n) => n.data.type === BlockEnum.IterationStart)expect(startNodes).toHaveLength(1)})@@ -89,7 +89,7 @@ describe('preprocessNodesAndEdges', () => {data: { type: BlockEnum.IterationStart, title: '', desc: '' },}),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])expect(result.nodes).toEqual(nodes)})@@ -97,7 +97,7 @@ describe('preprocessNodesAndEdges', () => {const nodes = [createNode({ id: 'loop-1', data: { type: BlockEnum.Loop, title: '', desc: '' } }),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const startNodes = result.nodes.filter((n) => n.data.type === BlockEnum.LoopStart)expect(startNodes).toHaveLength(1)})@@ -110,7 +110,7 @@ describe('preprocessNodesAndEdges', () => {}),createNode({ id: 'some-node', data: { type: BlockEnum.Code, title: '', desc: '' } }),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const startNodes = result.nodes.filter((n) => n.data.type === BlockEnum.LoopStart)expect(startNodes).toHaveLength(1)})@@ -127,7 +127,7 @@ describe('preprocessNodesAndEdges', () => {data: { type: BlockEnum.LoopStart, title: '', desc: '' },}),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])expect(result.nodes).toEqual(nodes)})@@ -143,7 +143,7 @@ describe('preprocessNodesAndEdges', () => {data: { type: BlockEnum.Code, title: '', desc: '' },}),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const newEdges = result.edgesexpect(newEdges).toHaveLength(1)expect(newEdges[0]!.target).toBe('child-1')@@ -163,7 +163,7 @@ describe('preprocessNodesAndEdges', () => {data: { type: BlockEnum.Code, title: '', desc: '' },}),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const newEdges = result.edgesexpect(newEdges).toHaveLength(1)expect(newEdges[0]!.target).toBe('child-1')@@ -181,7 +181,7 @@ describe('preprocessNodesAndEdges', () => {data: { type: BlockEnum.Loop, title: '', desc: '' },}),]- const result = preprocessNodesAndEdges(nodes as Node[], [])+ const result = preprocessNodesAndEdges(nodes, [])const iterNode = result.nodes.find((n) => n.id === 'iter-1')const loopNode = result.nodes.find((n) => n.id === 'loop-1')expect((iterNode!.data as IterationNodeType).start_node_id).toBeTruthy()diff --git a/web/app/reset-password/__tests__/page.spec.tsx b/web/app/reset-password/__tests__/page.spec.tsxindex dc78ef98173..4e77d61abb3 100644--- a/web/app/reset-password/__tests__/page.spec.tsx+++ b/web/app/reset-password/__tests__/page.spec.tsx@@ -44,7 +44,7 @@ describe('ResetPasswordPage', () => {typeof useRouter>)vi.mocked(useSearchParams).mockReturnValue(- new URLSearchParams() as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams() as ReturnType<typeof useSearchParams>,)vi.mocked(consoleClient.forgotPassword.post).mockResolvedValue({result: 'success',diff --git a/web/app/reset-password/check-code/__tests__/page.spec.tsx b/web/app/reset-password/check-code/__tests__/page.spec.tsxindex 352d2b23c85..78fabc295d8 100644--- a/web/app/reset-password/check-code/__tests__/page.spec.tsx+++ b/web/app/reset-password/check-code/__tests__/page.spec.tsx@@ -48,7 +48,7 @@ describe('ResetPasswordCheckCodePage', () => {new URLSearchParams({email: '[email protected]',token: 'email-token',- }) as unknown as ReturnType<typeof useSearchParams>,+ }) as ReturnType<typeof useSearchParams>,)vi.mocked(consoleClient.forgotPassword.validity.post).mockResolvedValue({email: '[email protected]',diff --git a/web/app/reset-password/set-password/__tests__/page.spec.tsx b/web/app/reset-password/set-password/__tests__/page.spec.tsxindex 59920c8f4a4..886664a976a 100644--- a/web/app/reset-password/set-password/__tests__/page.spec.tsx+++ b/web/app/reset-password/set-password/__tests__/page.spec.tsx@@ -56,7 +56,7 @@ const encodedSigninUrl =const setSearchParams = (params: Record<string, string>) => {mockUseSearchParams.mockReturnValue(- new URLSearchParams(params) as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams(params) as ReturnType<typeof useSearchParams>,)}diff --git a/web/app/signin/__tests__/normal-form.spec.tsx b/web/app/signin/__tests__/normal-form.spec.tsxindex 4e6f9cb3ff7..2e06289af4b 100644--- a/web/app/signin/__tests__/normal-form.spec.tsx+++ b/web/app/signin/__tests__/normal-form.spec.tsx@@ -75,8 +75,8 @@ const mockQueryResults = (inviteResult: ReturnType<typeof useQuery>,) => {mockUseQuery.mockImplementation((options) => {- const queryKey = options.queryKey as readonly unknown[]- return (queryKey[0] === 'account' ? profileResult : inviteResult) as ReturnType<typeof useQuery>+ const queryKey = options.queryKey+ return queryKey[0] === 'account' ? profileResult : inviteResult})}diff --git a/web/app/signin/__tests__/one-more-step.spec.tsx b/web/app/signin/__tests__/one-more-step.spec.tsxindex 40fc652434f..4ae0f1a9970 100644--- a/web/app/signin/__tests__/one-more-step.spec.tsx+++ b/web/app/signin/__tests__/one-more-step.spec.tsx@@ -25,8 +25,8 @@ vi.mock('@/next/navigation', () => ({const mockReplace = vi.fn()const mockSubmitOneMoreStep = vi.fn()-const mockUseRouter = useRouter as unknown as MockedFunction<typeof useRouter>-const mockUseSearchParams = useSearchParams as unknown as MockedFunction<typeof useSearchParams>+const mockUseRouter = useRouter as MockedFunction<typeof useRouter>+const mockUseSearchParams = useSearchParams as MockedFunction<typeof useSearchParams>const mockUseOneMoreStep = mockOneMoreStepHookdescribe('OneMoreStep', () => {@@ -38,7 +38,7 @@ describe('OneMoreStep', () => {mockUseSearchParams.mockReturnValue(new URLSearchParams('invitation_code=invite-code&redirect_url=%2Fapps%3Ftag%3Dworkflow',- ) as unknown as ReturnType<typeof useSearchParams>,+ ) as ReturnType<typeof useSearchParams>,)mockUseOneMoreStep.mockReturnValue({mutateAsync: mockSubmitOneMoreStep,diff --git a/web/app/signin/components/__tests__/social-auth.spec.tsx b/web/app/signin/components/__tests__/social-auth.spec.tsxindex a65ee2b7e64..e72eef3e76b 100644--- a/web/app/signin/components/__tests__/social-auth.spec.tsx+++ b/web/app/signin/components/__tests__/social-auth.spec.tsx@@ -25,9 +25,7 @@ const mockGetBrowserTimezone = vi.mocked(getBrowserTimezone)describe('SocialAuth', () => {beforeEach(() => {vi.clearAllMocks()- mockUseSearchParams.mockReturnValue(- new URLSearchParams() as unknown as ReturnType<typeof useSearchParams>,- )+ mockUseSearchParams.mockReturnValue(new URLSearchParams() as ReturnType<typeof useSearchParams>)mockUseLocale.mockReturnValue('zh-Hans')mockGetBrowserTimezone.mockReturnValue('Asia/Shanghai')})@@ -66,9 +64,7 @@ describe('SocialAuth', () => {it('should preserve invite token when adding timezone', () => {mockUseSearchParams.mockReturnValue(- new URLSearchParams('invite_token=invite-123') as unknown as ReturnType<- typeof useSearchParams- >,+ new URLSearchParams('invite_token=invite-123') as ReturnType<typeof useSearchParams>,)render(<SocialAuth />)diff --git a/web/app/signin/invite-settings/__tests__/page.spec.tsx b/web/app/signin/invite-settings/__tests__/page.spec.tsxindex 6ad5a105428..1bbcf71773b 100644--- a/web/app/signin/invite-settings/__tests__/page.spec.tsx+++ b/web/app/signin/invite-settings/__tests__/page.spec.tsx@@ -91,15 +91,13 @@ vi.mock('@/utils/timezone', () => ({const mockReplace = vi.fn()const mockRefetch = vi.fn()-const mockUseLocale = useLocale as unknown as MockedFunction<typeof useLocale>-const mockUseRouter = useRouter as unknown as MockedFunction<typeof useRouter>-const mockUseSearchParams = useSearchParams as unknown as MockedFunction<typeof useSearchParams>+const mockUseLocale = useLocale as MockedFunction<typeof useLocale>+const mockUseRouter = useRouter as MockedFunction<typeof useRouter>+const mockUseSearchParams = useSearchParams as MockedFunction<typeof useSearchParams>const mockActivateMember = vi.mocked(consoleClient.activate.post)const mockUseQuery = mockProfileQueryconst mockUseInvitationCheck = mockInvitationCheckHook-const mockGetBrowserTimezone = getBrowserTimezone as unknown as MockedFunction<- typeof getBrowserTimezone->+const mockGetBrowserTimezone = getBrowserTimezone as MockedFunction<typeof getBrowserTimezone>describe('InviteSettingsPage', () => {beforeEach(() => {@@ -110,9 +108,7 @@ describe('InviteSettingsPage', () => {typeof useRouter>)mockUseSearchParams.mockReturnValue(- new URLSearchParams('invite_token=invite-token') as unknown as ReturnType<- typeof useSearchParams- >,+ new URLSearchParams('invite_token=invite-token') as ReturnType<typeof useSearchParams>,)mockUseInvitationCheck.mockReturnValue({data: {@@ -320,7 +316,7 @@ describe('InviteSettingsPage', () => {mockUseSearchParams.mockReturnValue(new URLSearchParams('invite_token=invite-token&redirect_url=https%3A%2F%2Fgoogle.com',- ) as unknown as ReturnType<typeof useSearchParams>,+ ) as ReturnType<typeof useSearchParams>,)render(<InviteSettingsPage />)diff --git a/web/app/signup/check-code/__tests__/page.spec.tsx b/web/app/signup/check-code/__tests__/page.spec.tsxindex 54219bb309a..b747a7c7206 100644--- a/web/app/signup/check-code/__tests__/page.spec.tsx+++ b/web/app/signup/check-code/__tests__/page.spec.tsx@@ -46,9 +46,9 @@ vi.mock('@/next/navigation', () => ({useSearchParams: vi.fn(),}))-const mockUseLocale = useLocale as unknown as MockedFunction<typeof useLocale>-const mockUseRouter = useRouter as unknown as MockedFunction<typeof useRouter>-const mockUseSearchParams = useSearchParams as unknown as MockedFunction<typeof useSearchParams>+const mockUseLocale = useLocale as MockedFunction<typeof useLocale>+const mockUseRouter = useRouter as MockedFunction<typeof useRouter>+const mockUseSearchParams = useSearchParams as MockedFunction<typeof useSearchParams>const mockUseMailValidity = mockMailValidityHookconst mockUseSendMail = mockSendMailHook@@ -65,7 +65,7 @@ describe('Signup Check Code Page', () => {new URLSearchParams({email: '[email protected]',token: 'signup-token',- }) as unknown as ReturnType<typeof useSearchParams>,+ }) as ReturnType<typeof useSearchParams>,)mockUseMailValidity.mockReturnValue({mutateAsync: mockVerifyCode,diff --git a/web/app/signup/components/input-mail.spec.tsx b/web/app/signup/components/input-mail.spec.tsxindex 8e0c2055a68..3508e727e05 100644--- a/web/app/signup/components/input-mail.spec.tsx+++ b/web/app/signup/components/input-mail.spec.tsx@@ -52,8 +52,8 @@ vi.mock('@/next/navigation', () => ({type UseSendMailResult = ReturnType<typeof mockSendMailHook>-const mockUseLocale = useLocale as unknown as MockedFunction<typeof useLocale>-const mockUseSearchParams = useSearchParams as unknown as MockedFunction<typeof useSearchParams>+const mockUseLocale = useLocale as MockedFunction<typeof useLocale>+const mockUseSearchParams = useSearchParams as MockedFunction<typeof useSearchParams>const mockUseSendMail = mockSendMailHookconst renderForm = ({@@ -76,9 +76,7 @@ const renderForm = ({describe('InputMail Form', () => {beforeEach(() => {vi.clearAllMocks()- mockUseSearchParams.mockReturnValue(- new URLSearchParams() as unknown as ReturnType<typeof useSearchParams>,- )+ mockUseSearchParams.mockReturnValue(new URLSearchParams() as ReturnType<typeof useSearchParams>)mockSubmitMail.mockResolvedValue({ result: 'success', data: 'token' })})@@ -145,9 +143,9 @@ describe('InputMail Form', () => {describe('Registration Navigation', () => {it('should preserve the current query when navigating to sign in', () => {mockUseSearchParams.mockReturnValue(- new URLSearchParams(- 'redirect_url=%2Fapps%3Ftag%3Dworkflow&source=pricing',- ) as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams('redirect_url=%2Fapps%3Ftag%3Dworkflow&source=pricing') as ReturnType<+ typeof useSearchParams+ >,)renderForm()diff --git a/web/app/signup/set-password/__tests__/page.spec.tsx b/web/app/signup/set-password/__tests__/page.spec.tsxindex 800cc2e1c6f..31e1a6a1f81 100644--- a/web/app/signup/set-password/__tests__/page.spec.tsx+++ b/web/app/signup/set-password/__tests__/page.spec.tsx@@ -62,13 +62,11 @@ vi.mock('@/utils/create-app-tracking', () => ({const mockRegister = vi.fn()const mockReplace = vi.fn()-const mockUseLocale = useLocale as unknown as MockedFunction<typeof useLocale>-const mockUseSearchParams = useSearchParams as unknown as MockedFunction<typeof useSearchParams>-const mockUseRouter = useRouter as unknown as MockedFunction<typeof useRouter>+const mockUseLocale = useLocale as MockedFunction<typeof useLocale>+const mockUseSearchParams = useSearchParams as MockedFunction<typeof useSearchParams>+const mockUseRouter = useRouter as MockedFunction<typeof useRouter>const mockUseMailRegister = mockMailRegisterHook-const mockGetBrowserTimezone = getBrowserTimezone as unknown as MockedFunction<- typeof getBrowserTimezone->+const mockGetBrowserTimezone = getBrowserTimezone as MockedFunction<typeof getBrowserTimezone>const renderWithQueryClient = (ui: ReactElement) => {const queryClient = new QueryClient({@@ -87,7 +85,7 @@ describe('Signup Set Password Page', () => {Cookies.remove('utm_info')mockUseLocale.mockReturnValue('zh-Hans')mockUseSearchParams.mockReturnValue(- new URLSearchParams('token=register-token') as unknown as ReturnType<typeof useSearchParams>,+ new URLSearchParams('token=register-token') as ReturnType<typeof useSearchParams>,)mockUseRouter.mockReturnValue({ replace: mockReplace } as unknown as ReturnType<typeof useRouter@@ -195,7 +193,7 @@ describe('Signup Set Password Page', () => {mockUseSearchParams.mockReturnValue(new URLSearchParams('token=register-token&redirect_url=%2Fapps%3Ftag%3Dworkflow',- ) as unknown as ReturnType<typeof useSearchParams>,+ ) as ReturnType<typeof useSearchParams>,)mockRegister.mockResolvedValue({ result: 'success', data: {} })diff --git a/web/context/i18n.spec.ts b/web/context/i18n.spec.tsindex bbcf0b47c70..0d20ea3ceef 100644--- a/web/context/i18n.spec.ts+++ b/web/context/i18n.spec.ts@@ -295,9 +295,7 @@ describe('useDocLink', () => {] as const)('should fall back to the enterprise documentation home for %s', (communityPath) => {const { result } = renderHook(() => useDocLink())- expect(result.current(communityPath as DocPathWithoutLang)).toBe(- `${enterpriseDocBaseUrl}/en/`,- )+ expect(result.current(communityPath)).toBe(`${enterpriseDocBaseUrl}/en/`)})it('should open the enterprise documentation home when no path is provided', () => {diff --git a/web/features/agent-v2/agent-detail/configure/components/preview/chat-config.ts b/web/features/agent-v2/agent-detail/configure/components/preview/chat-config.tsindex b39af5f27d8..4b0390caddb 100644--- a/web/features/agent-v2/agent-detail/configure/components/preview/chat-config.ts+++ b/web/features/agent-v2/agent-detail/configure/components/preview/chat-config.ts@@ -256,7 +256,7 @@ export const buildChatConfig = ({},},dataset_configs: toLegacyPreviewDatasetConfigs(agentSoulConfig?.knowledge),- file_upload: toPreviewFileUploadConfig(appFeatures.file_upload as FileUpload | undefined),+ file_upload: toPreviewFileUploadConfig(appFeatures.file_upload),system_parameters: defaultSystemParameters,supportCitationHitInfo: true,}diff --git a/web/features/skills/detail/file-editor.tsx b/web/features/skills/detail/file-editor.tsxindex a17d02ec43a..59d5fff3275 100644--- a/web/features/skills/detail/file-editor.tsx+++ b/web/features/skills/detail/file-editor.tsx@@ -1181,8 +1181,7 @@ export function FileEditor({<divclassName="w-full space-y-0.5"onBlurCapture={(event) => {- if (event.currentTarget.contains(event.relatedTarget as Node | null))- return+ if (event.currentTarget.contains(event.relatedTarget)) returnhandleAddMetadata(metadataKeyDraftRef.current,diff --git a/web/features/skills/detail/markdown-editor.tsx b/web/features/skills/detail/markdown-editor.tsxindex 02b4a7405a8..9a96c430b0c 100644--- a/web/features/skills/detail/markdown-editor.tsx+++ b/web/features/skills/detail/markdown-editor.tsx@@ -646,7 +646,7 @@ export function EditableMetadataEntry({onValueChange={setValueDraft}valuePlaceholder="Value"onBlurCapture={(event) => {- if (event.currentTarget.contains(event.relatedTarget as Node | null)) return+ if (event.currentTarget.contains(event.relatedTarget)) returncommit()}}/>diff --git a/web/package.json b/web/package.jsonindex 1d04988c6c2..ddc04d3b833 100644--- a/web/package.json+++ b/web/package.json@@ -26,6 +26,7 @@"i18n:migrate-selectors": "node ./scripts/migrate-i18n-selectors.ts","lint:a11y": "node ./scripts/lint-a11y.mjs","lint:tss": "tsslint --project tsconfig.json",+ "migrate:type-assertions": "TSSLINT_TYPE_ASSERTION_MIGRATION=true tsslint --project tsconfig.json --force --fix","preinstall": "npx only-allow pnpm","start": "node ./scripts/copy-and-start.mjs","start:vinext": "vinext start",diff --git a/web/plugins/tsslint/no-unnecessary-type-assertion.test.ts b/web/plugins/tsslint/no-unnecessary-type-assertion.test.tsnew file mode 100644index 00000000000..bfbe318d717--- /dev/null+++ b/web/plugins/tsslint/no-unnecessary-type-assertion.test.ts@@ -0,0 +1,84 @@+// @vitest-environment node++import { describe, expect, it } from 'vite-plus/test'+import rule from './no-unnecessary-type-assertion'+import { lintWithRule } from './test-utils'++const lint = (code: string) => lintWithRule(rule, code)+const fixedLines = (code: string) =>+ lint(code).map((result) => result.fixed.trimEnd().split('\n').at(-1))++describe('no-unnecessary-type-assertion', () => {+ it('removes an assertion to the type the value already has', () => {+ expect(fixedLines('declare const a: string[]\nconst b = a as string[]\n')).toEqual([+ 'const b = a',+ ])+ })++ it('removes an upcast when the receiver type is fixed', () => {+ const prelude = 'declare const s: string\ndeclare function take(value: string | number): void\n'+ expect(fixedLines(`${prelude}take(s as string | number)\n`)).toEqual(['take(s)'])+ expect(+ fixedLines(`${prelude}function f(): string | number {\n return s as string | number\n}\n`),+ ).toEqual(['}'])+ const assign = 'declare const d: { a: string; b: number }\ndeclare let t: { a: string }\n'+ expect(fixedLines(`${assign}t = d as { a: string }\n`)).toEqual(['t = d'])+ })++ it('keeps upcasts whose receiver type is not fixed', () => {+ const prelude = 'declare const s: string\n'+ expect(lint(`${prelude}const v = s as string | number\n`)).toEqual([])+ expect(+ lint(`${prelude}declare function id<T>(value: T): T\nid(s as string | number)\n`),+ ).toEqual([])+ const overloads =+ 'declare function take(value: string): void\ndeclare function take(value: string | number): void\n'+ expect(lint(`${prelude}${overloads}take(s as string | number)\n`)).toEqual([])+ expect(lint(`${prelude}declare let u: string | number\nu = s as string | number\n`)).toEqual([])+ })++ it('keeps assertions on values typed by their context', () => {+ expect(lint("const mode = 'a' as 'a' | 'b'\n")).toEqual([])+ const generic = [+ 'declare function get<T>(url: string): Promise<T>',+ "export const load = () => get('/site') as Promise<{ name: string }>",+ ].join('\n')+ expect(lint(generic)).toEqual([])+ })++ it('keeps an assertion that stops a literal type from widening', () => {+ expect(lint("const a = 'a'\nlet b = a as 'a'\n")).toEqual([])+ })++ it('keeps an assertion that stops a reference from being narrowed', () => {+ const prelude = 'declare let value: string | number\n'+ expect(lint(`${prelude}if (typeof (value as string | number) === 'string') {}\n`)).toEqual([])+ expect(lint(`${prelude}switch (value as string | number) {}\n`)).toEqual([])+ const state = "type State = { kind: 'idle' } | { kind: 'busy' }\ndeclare let state: State\n"+ expect(lint(`${state}if ((state as State).kind === 'idle') {}\n`)).toEqual([])+ expect(lint(`${state}const { kind } = state as State\n`)).toEqual([])+ })++ describe('double assertions', () => {+ it('drops the unknown step when the types are assignable in one direction', () => {+ const code = [+ 'type A = { a: string }',+ 'type B = A & { b: number }',+ 'declare const a: A',+ 'declare const b: B',+ 'const up = b as unknown as A',+ 'const down = a as unknown as B',+ ].join('\n')+ expect(lint(code).map((r) => r.fixed)).toEqual([+ expect.stringContaining('const up = b as A\n'),+ expect.stringContaining('const down = a as B'),+ ])+ })++ it('keeps both steps between unrelated types or for values typed by their context', () => {+ expect(lint('declare const a: string\nconst b = a as unknown as number\n')).toEqual([])+ const code = "type A = { scope: 'a' | 'b' }\nconst b = { scope: 'other' } as unknown as A\n"+ expect(lint(code)).toEqual([])+ })+ })+})diff --git a/web/plugins/tsslint/no-unnecessary-type-assertion.ts b/web/plugins/tsslint/no-unnecessary-type-assertion.tsnew file mode 100644index 00000000000..a49fe7ce528--- /dev/null+++ b/web/plugins/tsslint/no-unnecessary-type-assertion.ts@@ -0,0 +1,279 @@+import type { Rule } from '@tsslint/config'+import type * as ts from 'typescript'++/**+ * Migration rule: removes `value as T` assertions and shortens `value as unknown as T` where+ * that does not change any type in this codebase. It is not part of the regular `lint:tss`+ * run; enable it with `pnpm migrate:type-assertions` and verify the result with `tsc`.+ *+ * The checks are limited to what the migration needed:+ *+ * - Values typed by their context (literals, object/array literals, functions, generic calls)+ * are skipped, since `as T` shapes their type.+ * - An assertion to the type the value already has is removed, unless it is a literal type+ * (which would widen), a reference in a narrowing position, or a destructured const.+ * - An upcast is removed only where the receiver type is fixed: a non-generic,+ * non-overloaded call argument, an annotated non-generic return, or an assignment whose+ * target type is not a union.+ * - For `value as unknown as T`, the `unknown` step is dropped when `value` and `T` are+ * assignable in one direction.+ */+const noUnnecessaryTypeAssertion: Rule = ({ typescript: tsApi, program, file, report }) => {+ const checker = program.getTypeChecker()++ const skipParentheses = (node: ts.Expression): ts.Expression => {+ let current = node+ while (tsApi.isParenthesizedExpression(current)) current = current.expression+ return current+ }++ const getPositionNode = (node: ts.Expression): ts.Expression => {+ let current = node+ while (tsApi.isParenthesizedExpression(current.parent)) current = current.parent+ return current+ }++ const isGenericCall = (node: ts.CallLikeExpression): boolean => {+ const declaration = checker.getResolvedSignature(node)?.getDeclaration()+ if (!declaration || declaration.typeParameters?.length) return true+ if (tsApi.isCallExpression(node) || tsApi.isNewExpression(node)) {+ const calleeType = checker.getTypeAtLocation(node.expression)+ const signatures = tsApi.isNewExpression(node)+ ? calleeType.getConstructSignatures()+ : calleeType.getCallSignatures()+ return signatures.some((signature) => signature.getTypeParameters()?.length)+ }+ return false+ }++ const isContextSensitive = (node: ts.Expression): boolean => {+ const value = skipParentheses(node)+ if (+ tsApi.isLiteralExpression(value) ||+ tsApi.isNoSubstitutionTemplateLiteral(value) ||+ tsApi.isTemplateExpression(value) ||+ tsApi.isObjectLiteralExpression(value) ||+ tsApi.isArrayLiteralExpression(value) ||+ tsApi.isFunctionExpression(value) ||+ tsApi.isArrowFunction(value) ||+ tsApi.isClassExpression(value) ||+ tsApi.isJsxElement(value) ||+ tsApi.isJsxSelfClosingElement(value) ||+ tsApi.isJsxFragment(value) ||+ tsApi.isPrefixUnaryExpression(value) ||+ value.kind === tsApi.SyntaxKind.TrueKeyword ||+ value.kind === tsApi.SyntaxKind.FalseKeyword+ )+ return true+ if (+ tsApi.isCallExpression(value) ||+ tsApi.isNewExpression(value) ||+ tsApi.isTaggedTemplateExpression(value)+ )+ return isGenericCall(value)+ if (tsApi.isConditionalExpression(value))+ return isContextSensitive(value.whenTrue) || isContextSensitive(value.whenFalse)+ if (tsApi.isBinaryExpression(value)) {+ const operator = value.operatorToken.kind+ if (+ operator === tsApi.SyntaxKind.BarBarToken ||+ operator === tsApi.SyntaxKind.QuestionQuestionToken ||+ operator === tsApi.SyntaxKind.AmpersandAmpersandToken ||+ operator === tsApi.SyntaxKind.CommaToken ||+ operator === tsApi.SyntaxKind.EqualsToken+ )+ return isContextSensitive(value.left) || isContextSensitive(value.right)+ return false+ }+ if (+ tsApi.isAwaitExpression(value) ||+ tsApi.isNonNullExpression(value) ||+ tsApi.isSatisfiesExpression(value)+ )+ return isContextSensitive(value.expression)+ return false+ }++ const getFixedReceiverType = (node: ts.Expression): ts.Type | undefined => {+ const current = getPositionNode(node)+ const parent = current.parent++ if (+ (tsApi.isCallExpression(parent) || tsApi.isNewExpression(parent)) &&+ parent.arguments?.includes(current)+ ) {+ if (isGenericCall(parent)) return undefined+ const calleeType = checker.getTypeAtLocation(parent.expression)+ const signatures = tsApi.isNewExpression(parent)+ ? calleeType.getConstructSignatures()+ : calleeType.getCallSignatures()+ if (signatures.length !== 1) return undefined+ return checker.getContextualType(current)+ }+ if (tsApi.isReturnStatement(parent)) {+ const fn = tsApi.findAncestor(parent, tsApi.isFunctionLike)+ if (!fn?.type || fn.typeParameters?.length) return undefined+ return checker.getContextualType(current)+ }+ // Assigning to a union-typed binding narrows it to the assigned type.+ if (+ tsApi.isBinaryExpression(parent) &&+ parent.operatorToken.kind === tsApi.SyntaxKind.EqualsToken &&+ parent.right === current &&+ !tsApi.isObjectLiteralExpression(parent.left) &&+ !tsApi.isArrayLiteralExpression(parent.left)+ ) {+ const targetType = checker.getTypeAtLocation(parent.left)+ return targetType.isUnion() ? undefined : targetType+ }+ return undefined+ }++ const isNarrowableReference = (node: ts.Expression): boolean => {+ const value = skipParentheses(node)+ if (tsApi.isNonNullExpression(value)) return isNarrowableReference(value.expression)+ return (+ tsApi.isIdentifier(value) ||+ value.kind === tsApi.SyntaxKind.ThisKeyword ||+ tsApi.isPropertyAccessExpression(value) ||+ tsApi.isElementAccessExpression(value)+ )+ }++ const narrowingOperators = new Set([+ tsApi.SyntaxKind.EqualsEqualsEqualsToken,+ tsApi.SyntaxKind.ExclamationEqualsEqualsToken,+ tsApi.SyntaxKind.EqualsEqualsToken,+ tsApi.SyntaxKind.ExclamationEqualsToken,+ tsApi.SyntaxKind.InstanceOfKeyword,+ tsApi.SyntaxKind.InKeyword,+ tsApi.SyntaxKind.AmpersandAmpersandToken,+ tsApi.SyntaxKind.BarBarToken,+ tsApi.SyntaxKind.QuestionQuestionToken,+ ])++ // An assertion turns a reference into an expression, so control flow does not narrow it.+ const isNarrowingPosition = (node: ts.Expression): boolean => {+ let current: ts.Expression = node+ for (;;) {+ const parent = current.parent+ if (tsApi.isParenthesizedExpression(parent) || tsApi.isNonNullExpression(parent))+ current = parent+ else if (+ (tsApi.isPropertyAccessExpression(parent) || tsApi.isElementAccessExpression(parent)) &&+ parent.expression === current+ )+ current = parent+ else break+ }+ const parent = current.parent+ if (tsApi.isTypeOfExpression(parent)) return true+ if (tsApi.isPrefixUnaryExpression(parent))+ return parent.operator === tsApi.SyntaxKind.ExclamationToken+ if (tsApi.isBinaryExpression(parent)) return narrowingOperators.has(parent.operatorToken.kind)+ if (+ tsApi.isIfStatement(parent) ||+ tsApi.isWhileStatement(parent) ||+ tsApi.isDoStatement(parent) ||+ tsApi.isSwitchStatement(parent)+ )+ return parent.expression === current+ if (tsApi.isForStatement(parent)) return parent.condition === current+ if (tsApi.isConditionalExpression(parent)) return parent.condition === current+ if (+ tsApi.isCallExpression(parent) &&+ (parent.arguments.includes(current) || parent.expression === current)+ ) {+ const signature = checker.getResolvedSignature(parent)+ return !signature || !!checker.getTypePredicateOfSignature(signature)+ }+ return false+ }++ // Destructured discriminants narrow each other, which the assertion prevents.+ const isDestructuredConstInitializer = (node: ts.Expression): boolean => {+ const current = getPositionNode(node)+ const parent = current.parent+ return (+ tsApi.isVariableDeclaration(parent) &&+ !tsApi.isIdentifier(parent.name) &&+ parent.initializer === current &&+ !!(tsApi.getCombinedNodeFlags(parent) & tsApi.NodeFlags.Const)+ )+ }++ const reportFix = (node: ts.Node, message: string, newText: string) => {+ const start = node.getStart(file)+ report(message, start, node.end)+ .asError()+ .withFix(message, () => [+ {+ fileName: file.fileName,+ textChanges: [{ span: { start, length: node.end - start }, newText }],+ },+ ])+ }++ const checkDoubleAssertion = (node: ts.AsExpression, inner: ts.AsExpression) => {+ const value = inner.expression+ if (isContextSensitive(value)) return+ const sourceType = checker.getTypeAtLocation(value)+ const targetType = checker.getTypeFromTypeNode(node.type)+ if (sourceType.flags & tsApi.TypeFlags.Any) return+ if (+ sourceType.flags & tsApi.TypeFlags.Unknown ||+ checker.isTypeAssignableTo(sourceType, targetType) ||+ checker.isTypeAssignableTo(targetType, sourceType)+ )+ reportFix(+ node,+ 'Use a single type assertion',+ `${value.getText(file)} as ${node.type.getText(file)}`,+ )+ }++ const checkAssertion = (node: ts.AsExpression) => {+ const value = node.expression+ if (isContextSensitive(value)) return+ if (isNarrowableReference(value) && isNarrowingPosition(node)) return+ if (isDestructuredConstInitializer(node)) return++ const sourceType = checker.getTypeAtLocation(value)+ const targetType = checker.getTypeFromTypeNode(node.type)+ if (sourceType.flags & tsApi.TypeFlags.Any) return++ const isSameType =+ sourceType === targetType && checker.getBaseTypeOfLiteralType(sourceType) === sourceType+ if (!isSameType) {+ if (!checker.isTypeAssignableTo(sourceType, targetType)) return+ const receiverType = getFixedReceiverType(node)+ if (+ !receiverType ||+ receiverType.flags & tsApi.TypeFlags.Any ||+ !checker.isTypeAssignableTo(sourceType, receiverType)+ )+ return+ }+ reportFix(node, 'Remove the type assertion', value.getText(file))+ }++ const visit = (node: ts.Node): void => {+ tsApi.forEachChild(node, visit)++ if (!tsApi.isAsExpression(node) || tsApi.isConstTypeReference(node.type)) return+ let outer: ts.Node = node.parent+ while (tsApi.isParenthesizedExpression(outer)) outer = outer.parent+ if (node.type.kind === tsApi.SyntaxKind.UnknownKeyword && tsApi.isAsExpression(outer)) return++ const inner = skipParentheses(node.expression)+ if (tsApi.isAsExpression(inner)) {+ if (inner.type.kind === tsApi.SyntaxKind.UnknownKeyword) checkDoubleAssertion(node, inner)+ return+ }+ checkAssertion(node)+ }++ visit(file)+}++export default noUnnecessaryTypeAssertiondiff --git a/web/plugins/tsslint/test-utils.ts b/web/plugins/tsslint/test-utils.tsnew file mode 100644index 00000000000..c709ca5c605--- /dev/null+++ b/web/plugins/tsslint/test-utils.ts@@ -0,0 +1,46 @@+import type { Reporter, Rule } from '@tsslint/config'+import ts from 'typescript'++const fileName = '/virtual/test.ts'++/** Runs a tsslint rule on a single strict-mode file and returns each report with its fix applied. */+export function lintWithRule(rule: Rule, code: string) {+ const options: ts.CompilerOptions = { strict: true, noEmit: true }+ const host = ts.createCompilerHost(options)+ const getSourceFile = host.getSourceFile+ host.getSourceFile = (name, languageVersion, ...rest) =>+ name === fileName+ ? ts.createSourceFile(name, code, languageVersion, true)+ : getSourceFile(name, languageVersion, ...rest)+ const program = ts.createProgram([fileName], options, host)+ const file = program.getSourceFile(fileName)!++ const results: { message: string; fixed: string }[] = []+ rule({+ typescript: ts,+ program,+ file,+ report(message) {+ const reporter: Reporter = {+ at: () => reporter,+ asWarning: () => reporter,+ asError: () => reporter,+ asSuggestion: () => reporter,+ withDeprecated: () => reporter,+ withUnnecessary: () => reporter,+ withRefactor: () => reporter,+ withoutCache: () => reporter,+ withFix(_title, getChanges) {+ const { span, newText } = getChanges()[0]!.textChanges[0]!+ results.push({+ message,+ fixed: code.slice(0, span.start) + newText + code.slice(span.start + span.length),+ })+ return reporter+ },+ }+ return reporter+ },+ })+ return results+}diff --git a/web/scripts/analyze-i18n-diff.ts b/web/scripts/analyze-i18n-diff.tsindex b09bd3e073c..0ed0d7884ec 100644--- a/web/scripts/analyze-i18n-diff.ts+++ b/web/scripts/analyze-i18n-diff.ts@@ -53,9 +53,9 @@ function flattenObject(obj: NestedTranslation, prefix = ''): FlatTranslation {result[newKey] = value} else if (Array.isArray(value)) {// Preserve arrays as-is- result[newKey] = value as string[]+ result[newKey] = value} else if (typeof value === 'object' && value !== null) {- Object.assign(result, flattenObject(value as NestedTranslation, newKey))+ Object.assign(result, flattenObject(value, newKey))}}diff --git a/web/scripts/migrate-i18n-selectors.ts b/web/scripts/migrate-i18n-selectors.tsindex 0e552538f0e..deb8b98f7bb 100644--- a/web/scripts/migrate-i18n-selectors.ts+++ b/web/scripts/migrate-i18n-selectors.ts@@ -920,7 +920,7 @@ function transformAnalyzedSource(isTranslationCall(node, checker, sourceFile) &&node.arguments.length) {- const keyExpression = node.arguments[0]! as ts.Expression+ const keyExpression = node.arguments[0]!if (!isSelectorCompatibleExpression(keyExpression, checker, sourceFile)) {edits.push({end: keyExpression.end,@@ -932,7 +932,7 @@ function transformAnalyzedSource(const fallback = node.arguments[1]if (fallback && isStringExpression(fallback)) {const options = node.arguments[2]- if (options && ts.isObjectLiteralExpression(unwrapExpression(options as ts.Expression))) {+ if (options && ts.isObjectLiteralExpression(unwrapExpression(options))) {const optionsText = options.getText(sourceFile)const properties = optionsText.slice(1, -1).trim()edits.push({diff --git a/web/service/base.ts b/web/service/base.tsindex 23a0cffd5bd..5ff63ebaf34 100644--- a/web/service/base.ts+++ b/web/service/base.ts@@ -716,8 +716,8 @@ export const ssePost = async ()options.headers = new Headers(options.headers)- const contentType = (options.headers as Headers).get('Content-Type')- if (!contentType) (options.headers as Headers).set('Content-Type', ContentType.json)+ const contentType = options.headers.get('Content-Type')+ if (!contentType) options.headers.set('Content-Type', ContentType.json)getAbortController?.(abortController)@@ -874,8 +874,8 @@ export const sseGet = async ()options.headers = new Headers(options.headers)- const contentType = (options.headers as Headers).get('Content-Type')- if (!contentType) (options.headers as Headers).set('Content-Type', ContentType.json)+ const contentType = options.headers.get('Content-Type')+ if (!contentType) options.headers.set('Content-Type', ContentType.json)getAbortController?.(abortController)@@ -1012,7 +1012,7 @@ export const sseGeneratorPost = (}globalThis- .fetch(urlWithPrefix, options as RequestInit)+ .fetch(urlWithPrefix, options).then((res) => {if (!/^[23]\d{2}$/.test(String(res.status))) {if (res.status === 401) {diff --git a/web/service/console/server.spec.ts b/web/service/console/server.spec.tsindex aa993e419a9..e4090c787e5 100644--- a/web/service/console/server.spec.ts+++ b/web/service/console/server.spec.ts@@ -185,12 +185,13 @@ describe('unified Console server identity', () => {identities.run(identity, () => consoleClient.systemFeatures.get()),),)- expect(- fetch.mock.calls.map(([request]) => (request as Request).headers.get('cookie')).sort(),- ).toEqual(['session=alice', 'session=bob'])- expect(- fetch.mock.calls.map(([request]) => (request as Request).headers.get('X-CSRF-Token')).sort(),- ).toEqual(['alice', 'bob'])+ expect(fetch.mock.calls.map(([request]) => request.headers.get('cookie')).sort()).toEqual([+ 'session=alice',+ 'session=bob',+ ])+ expect(fetch.mock.calls.map(([request]) => request.headers.get('X-CSRF-Token')).sort()).toEqual(+ ['alice', 'bob'],+ )})it('supports anonymous requests and selects the internal host at call time', async () => {diff --git a/web/service/use-snippets.ts b/web/service/use-snippets.tsindex d375167cd49..c24911ca261 100644--- a/web/service/use-snippets.ts+++ b/web/service/use-snippets.ts@@ -98,7 +98,7 @@ const toSnippetCanvasData = (workflow?: SnippetWorkflow | null): SnippetCanvasDaif (!graph || typeof graph !== 'object') return DEFAULT_GRAPH- const graphRecord = graph as Record<string, unknown>+ const graphRecord = graphreturn {nodes: Array.isArray(graphRecord.nodes)diff --git a/web/tsslint.config.ts b/web/tsslint.config.tsindex c547a09c598..94f4c45190f 100644--- a/web/tsslint.config.ts+++ b/web/tsslint.config.ts@@ -1,4 +1,8 @@import { defineConfig, importESLintRules } from '@tsslint/config'+import noUnnecessaryTypeAssertion from './plugins/tsslint/no-unnecessary-type-assertion.ts'++// Migration-only rules stay out of the regular `lint:tss` run; see `migrate:type-assertions`.+const enableTypeAssertionMigration = process.env.TSSLINT_TYPE_ASSERTION_MIGRATION === 'true'// Run `npx tsslint-docgen` to generate documentation for the configured rules.@@ -7,5 +11,8 @@ export default defineConfig({...(await importESLintRules({'react-x/no-leaked-conditional-rendering': 'error',})),+ ...(enableTypeAssertionMigration+ ? { dify: { 'no-unnecessary-type-assertion': noUnnecessaryTypeAssertion } }+ : {}),},})diff --git a/web/utils/completion-params.ts b/web/utils/completion-params.tsindex 86f7ed1ecf4..d5e70e376f0 100644--- a/web/utils/completion-params.ts+++ b/web/utils/completion-params.ts@@ -62,7 +62,7 @@ export const mergeValidCompletionParams = (return}if (Array.isArray(rule.options) && rule.options.length) {- if (!(rule.options as string[]).includes(value)) {+ if (!rule.options.includes(value)) {removedDetails[key] = 'unsupported option'return}