Skip to content

Correct use of typescript type declarations in the codebase #6263

Closed as not planned
@rigolepe

Description

@rigolepe

Feature Request

The generation of typescript type declarations fails: npx tsc. The errors can be revealed by running the existing type-check script for the frontend codebase:

npm run type-check

gives:

Found 27 errors in 18 files.

Errors  Files
     1  src/components/common/animatedNumbers/index.tsx:2
     1  src/components/common/arrayReaderComponent/index.tsx:1
     1  src/components/core/parameterRenderComponent/components/tableComponent/components/loadingOverlay/index.tsx:1
     1  src/CustomNodes/NoteNode/components/color-picker-buttons.tsx:3
     1  src/icons/AIML/index.tsx:6
     1  src/icons/athena/index.tsx:9
     1  src/icons/freezeAll/index.tsx:9
     1  src/icons/Perplexity/index.tsx:2
     3  src/modals/codeAreaModal/index.tsx:180
     1  src/modals/IOModal/components/chatView/chatInput/hooks/use-handle-file-change.ts:8
     1  src/pages/FlowPage/components/extraSidebarComponent/index.tsx:224
     1  src/pages/FlowPage/components/extraSidebarComponent/SidebarCategoryComponent/index.tsx:2
     1  src/pages/MainPage/oldComponents/componentsComponent/index.tsx:164
     1  src/pages/MainPage/utils/handle-download-folder.ts:2
     3  src/pages/ProfileSettingsPage/index.tsx:9
     1  src/pages/SettingsPage/pages/GeneralPage/components/ProfileGradientForm/index.tsx:2
     1  src/pages/SettingsPage/pages/GlobalVariablesPage/index.tsx:41
     6  src/reportWebVitals.ts:1

The errors above ensure that editors (such as vscode) are littered with "red underlined code" because of incomplete type information. This undercuts the advantage of using typescript in the first place.

Motivation

Typescript enforces type safety, but it looks like this feature is a ignored in a lot of files. A lot can be fixed quickly by correcting the import paths.

Your Contribution

I could prepare a PR if core developers have no time to have a look at this. Let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions