Skip to content

@siemens/ix-vue: Incorrect type declaration path breaks TypeScript builds #2667

Description

@KPirmer

Prerequisites

  • I have read the Contributing Guidelines.
  • I have not leaked any internal/restricted information like screenshots, videos, code snippets, links etc.

What happened?

Description
When importing components from @siemens/ix-vue in TypeScript project, the TS compiler fails with the following error:

Could not find a declaration file for module '@siemens/ix-vue'. 'node_modules/@siemens/ix-vue/dist/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/siemens__ix-vue` if it exists or add a new declaration (.d.ts) file containing `declare module '@siemens/ix-vue';`

Cause of the Bug
The root cause seems to be that the @siemens/ix-vue package contains a mismatch between the declared types entry in its`package.json package layout and the actual file structure:

In the package.json of @siemens/ix-vue, the types key points to:

"types": "dist/index.d.ts"

The build process seems to output the declaration files nested inside src within the dist directory. The actual types file is located at:

node_modules/@siemens/ix-vue/dist/src/index.d.ts

Because TypeScript expects type definitions to be located in dist/index.d.ts, it fails to resolve types for this package, thus resulting into the TS compiler error.


Steps to reproduce

  1. Create a Vue 3 project with TypeScript.
  2. Install @siemens/ix-vue (v5.1.1).
  3. Import any component in a .vue or .ts file:
import { IxApplication } from "@siemens/ix-vue";
  1. Run standard TypeScript checks (e.g., vue-tsc --noEmit).

Temporary Workaround
Add the following workaround to your project's tsconfig.json paths mapping to pinpoint the current location of the type declaration file:

{
  "compilerOptions": {
    "paths": {
      "@siemens/ix-vue": ["./node_modules/@siemens/ix-vue/dist/src/index.d.ts"]
    }
  }
}

What type of frontend framework are you seeing the problem on?

Others

On which version of the frontend framework are you experiencing the issue?

vue@3.5.40

Which version of iX do you use?

5.1.1

Code to produce this issue.

1. Open stackblitz: https://stackblitz.com/edit/vitejs-vite-aepsv5p6?file=package.json,src%2FApp.vue&terminal=dev
2. Run npm run build or npm run lint

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogIts part of the team backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions