Prerequisites
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
- Create a Vue 3 project with TypeScript.
- Install @siemens/ix-vue (v5.1.1).
- Import any component in a .vue or .ts file:
import { IxApplication } from "@siemens/ix-vue";
- 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
Prerequisites
What happened?
Description
When importing components from
@siemens/ix-vuein TypeScript project, the TS compiler fails with the following error:Cause of the Bug
The root cause seems to be that the
@siemens/ix-vuepackage 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:The build process seems to output the declaration files nested inside
srcwithin thedistdirectory. The actual types file is located at: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
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.