You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ts-interface-generator: interface is not generated in multiple scenarios #337
I'm receiving an error for this case using v0.4.1:
\ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:97
throw new Error(`${statement.name ? statement.name.text : ""} inherits from ${interestingBaseClass} but the parent class ${typeChecker.getFullyQualifiedName(type.getSymbol())} seems to have no settings type`);
^
Error: OneMoreControl inherits from Control but the parent class "/ui5-typescript-helloworld/src/control/MyControl".MyControl seems to have no settings type
at \ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:97:39
at Array.forEach (<anonymous>)
at \ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:69:46
at Array.forEach (<anonymous>)
at \ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:67:43
at Array.forEach (<anonymous>)
at getManagedObjects (\ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:63:27)
at generateInterfaces (\ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:39:17)
at \ui5-typescript-helloworld\node_modules\@ui5\ts-interface-generator\dist\generateTSInterfaces.js:133:60
at Array.forEach (<anonymous>)
Hi @iljapostnovs,
I see... the generator tries to find the settings type of the parent class (to make its own settings type inherit from it). The settings type can only be found in the constructor signatures.
The problem is that at this time the parent class (MyControl) does not have any constructors yet. You know, the constructors are suggested in the console output of the generator and need to be added by hand. In the situation you showed, there is already the suggested output for MyControl constructors:
NOTE:
ClassMyControlinfile[c:/.../git/ui5-typescript/packages/ts-interface-generator/src/test/testdata/testControl/MyControl.ts]()needstocontainthefollowingconstructors,inordertomakeTypeScriptawareofthepossibleconstructorsettings.Pleasecopy&pastetheblockmanually,asthets-interface-generatorwillnottouchyoursourcefiles:
=====BEGIN=====// The following three lines were generated and should remain as-is to make TypeScript aware of the constructor signaturesconstructor(idOrSettings?: string |$MyControlSettings);constructor(id?: string,settings?: $MyControlSettings);constructor(id?: string,settings?: $MyControlSettings){super(id,settings);}=====END=====
Once the suggested constructors are added to MyControl, the next run of the generator does succeed. This is what I would suggest as temporary workaround.
I'm not sure whether the scenario is likely to happen - at least when MyControl is developed first, the constructors should already be added in the beginning and then creating OneMoreControl will succeed just fine. But apparently you encountered the scenario. Maybe the hint to add the constructors should be made clearer. Or maybe not doing so should result in an error?
But of course I can also try to handle this case. After all, all the way up the chain there is a UI5 base class with well-defined settings type. Might be a bit tricky, though, to get there in this stage of the generation, orthogonal to the regular flow... I'll have to check.
A first improvement could be to mention this possibility and workaround in the error message.
Thanks for reporting! I opened #346 to track it separately.
Activity
akudev commentedon Mar 9, 2022
Hi Ilja,
thanks for the issue report!
I just fixed it, so this issue will be gone with the next release. But #338 is not addressed yet.
Note that type "number" is not allowed for UI5 properties, only "int" or "float" - see https://ui5.sap.com/#/api/sap.ui.base.ManagedObject%23methods/sap.ui.base.ManagedObject.extend
Thanks and regards
Andreas
iljapostnovs commentedon Mar 10, 2022
Hi @akudev,
Thanks a lot!
Yeah, silly mistake by me. I was aware of that, but I guess my data typing was "typescripted" away for this issue :)
akudev commentedon Mar 22, 2022
The next release has been created now (0.4.1).
iljapostnovs commentedon Mar 22, 2022
Hi @akudev,
Thanks for letting me know!
I'm receiving an error for this case using v0.4.1:

akudev commentedon Mar 23, 2022
Hi @iljapostnovs,
I see... the generator tries to find the settings type of the parent class (to make its own settings type inherit from it). The settings type can only be found in the constructor signatures.
The problem is that at this time the parent class (MyControl) does not have any constructors yet. You know, the constructors are suggested in the console output of the generator and need to be added by hand. In the situation you showed, there is already the suggested output for MyControl constructors:
Once the suggested constructors are added to MyControl, the next run of the generator does succeed. This is what I would suggest as temporary workaround.
I'm not sure whether the scenario is likely to happen - at least when MyControl is developed first, the constructors should already be added in the beginning and then creating OneMoreControl will succeed just fine. But apparently you encountered the scenario. Maybe the hint to add the constructors should be made clearer. Or maybe not doing so should result in an error?
But of course I can also try to handle this case. After all, all the way up the chain there is a UI5 base class with well-defined settings type. Might be a bit tricky, though, to get there in this stage of the generation, orthogonal to the regular flow... I'll have to check.
A first improvement could be to mention this possibility and workaround in the error message.
Thanks for reporting! I opened #346 to track it separately.