SAP/ui5-typescript

Compatibility with Typescript V5

marianfoo opened this issue · 3 comments

Describe the bug

After updating typescript from 4.9.5 to 5.0.2 i get a error executing.
Do any additional things need to be done with the package so that Typescript V5 can be used?

npx @ui5/ts-interface-generator --watch
npx @ui5/ts-interface-generator --watch
Log level set to: info
Using the following TypeScript configuration file (automatically found, as none was given): ./tsconfig.json
Initializing TypeScript program with all source files and type definitions (this may take a few seconds)...
C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\typescript@5.0.2\node_modules\typescript\lib\typescript.js:20482
      array.pos = -1;
                ^

TypeError: Cannot create property 'pos' on string 'CustomDataType'
    at createNodeArray (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\typescript@5.0.2\node_modules\typescript\lib\typescript.js:20482:17)
    at asNodeArray (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\typescript@5.0.2\node_modules\typescript\lib\typescript.js:23945:22)
    at Object.createTypeParameterDeclaration (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\typescript@5.0.2\node_modules\typescript\lib\typescript.js:20841:24)
    at generateMethods (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\astGenerationHelper.js:307:21) 
    at buildAST (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:350:63)  
    at generateInterface (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:341:17)
    at C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:40:31
    at Array.forEach (<anonymous>)
    at generateInterfaces (C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\interfaceGenerationHelper.js:39:9)
    at C:\UI5\ui5-cc-excelUpload\node_modules\.pnpm\@ui5+ts-interface-generator@0.5.4\node_modules\@ui5\ts-interface-generator\dist\generateTSInterfaces.js:134:60

Node.js v18.12.1

Additional context

Using my repo https://github.com/marianfoo/ui5-cc-excelUpload

Recreate the error

git clone https://github.com/marianfoo/ui5-cc-excelUpload

Change Typescript to "5.0.2"
https://github.com/marianfoo/ui5-cc-excelUpload/blob/2e7e244348de676c9406c16ef744788dfc570d27/package.json#L73

pnpm i
npx @ui5/ts-interface-generator --watch

i guess this was fixed with 12be9aa
can you please publish the @ui5/ts-interface-generator? @akudev

tried with the newest version from GitHub, can confirm that the commit fixes the error

akudev commented

Release 0.5.5 with TS 5.0 support was done.
Thanks for reporting and verifying that the latest code fixes the issue.

Fixed by 12be9aa