SAP / ui5-typescript

Tooling to enable TypeScript support in SAPUI5/OpenUI5 projects
https://sap.github.io/ui5-typescript
Apache License 2.0
202 stars 28 forks source link

@ui5/ts-interface-generator: fails with older TS versions < 4.8 #396

Closed akudev closed 1 year ago

akudev commented 1 year ago

When TypeScript version 4.7 or below is used, generation fails with one of the following errors:

TypeError: Cannot create property 'pos' on string '$ExampleSettings'
    at setTextRangePos ...
Error: Debug Failure. Unhandled SyntaxKind: Unknown.
    at pipelineEmitWithHintWorker ...

The reason is an incompatible change of the TypeScript compiler API in factory.createInterfaceDeclaration(...) and factory.createParameterDeclaration(...) (first parameter was removed).

Solution: use TypeScript 4.8 or higher.

I don't think the issue is worth working around anymore, although a version check and adding a parameter would theoretically be possible.

akudev commented 1 year ago

I couldn't resist. Fixed. Generator should run with all versions from at least TS 4.5 onwards. Tested also with the upcoming version 5.1's release candidate.