[ts-interface-generator] interface generation fails if application contains mixins
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start with the npx @ui5/ts-interface-generator command and a ClassC.ts containing extends ClassA(ClassB), reproducing the failure from @ui5/[email protected]. Compare this with the workaround using tsconfig-generate-ts-interfaces.json and --config; done means type generation succeeds without excluding files containing mixins.
Written by the indexing model from the issue text.
Description
Describe the bug
Running npx @ui5/ts-interface-generator command in project containing mixins causing following error:
AppData\Local\npm-cache\_npx\a388873ad1487e68\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:172
throw new Error(`Type '${typeNode.getText()}' referenced in ${sourceFile.fileName} in the inheritance clause '${heritageClause.getFullText()}' could not be resolved.
^
Error: Type 'ClassA(ClassB)' referenced in ClassC.ts in the inheritance clause ' extends ClassA(ClassB)' could not be resolved.
Check the respective line in the source code: ts there an error for this type? Make sure the type is properly imported.
If a working "import" is not possible and it is a UI5 type (or type from another library), the issue could be caused by the respective type definitions not being available. They must be found by the TypeScript compiler according to the configuration in tsconfig. To verify this step-by-step, you can do the following:
1. Check whether the (UI5 or other) types are added as dependency in package.json (or available as transitive dependency)
2. Check inside which "node_modules" folder the types are actually available - if they are not, check whether "npm install" (or "yarn" etc.) has run successfully - maybe re-run it
3. Check the "tsconfig.json" file: types outside the default "@types" package must be explicitly added in the "types" or "typeRoots" section. Is the name and path correct?
One known cause of this error is that the "typeRoots" setting in tsconfig.json has wrong paths, which are not actually pointing to the correct location of the type definitions.
Or is there a different reason why this type would not be known?
at AppData\Local\npm-cache\_npx\a388873ad1487e68\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:172:39
at Array.forEach (<anonymous>)
at AppData\Local\npm-cache\_npx\a388873ad1487e68\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:168:46
at Array.forEach (<anonymous>)
at AppData\Local\npm-cache\_npx\a388873ad1487e68\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:166:43
This happens whenever project contains file with mixin akin to:
export default class ClassC extends ClassA(ClassB) {
// ...
}
Current workaround is to have separate tsconfig-generate-ts-interfaces.json file which excludes files containin mixin, and pass this file to --config parameter of interface generator.
Expected behavior
Successful type generation for project containing mixins.
Additional context
Reproduced in @ui5/[email protected]
- Dominant language
- TypeScript
- Stars
- 213
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from UI5/typescript
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
UI5/typescript#625 · 4 comments ·
-
dts-generator
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
UI5/typescript#529 · 3 comments ·
-
Dependency DashboardOpen
Difficulty 5/5 Over a week Newbie friendliness 15/100
UI5/typescript#587 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
UI5/typescript#532 ·
-
enhancement ts-interface-generator
Difficulty 5/5 Over a week Newbie friendliness 30/100
UI5/typescript#524 ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
eliasstravik/herdr-projects#1700 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Koenkk/zigbee2mqtt#33890 ·
Maintainers usually reply within 1 day
-
[bug] Socrates launchd-path adapter throws EISDIR when an import names a folder beside its .ts fileOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
danielmiessler/LifeOS#3123 ·
Maintainers usually reply within 5 days
-
[Feature]: Skill Workshop skill diet should use the configured utility model, not always the primaryOpenclawsweeper:fix-shape-clear clawsweeper:needs-live-repro clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr impact:auth-provider issue-rating: 🐚 platinum hermit P2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
openclaw/openclaw#210348 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day