-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Generated index.ts files have syntax errors, e.g. "Cannot redeclare exported variable ..." #278
Comments
How does your entity definition look like. Sth like this maybe: entity Entities: cuid, managed {
key ID: Integration;
} Are you redeclaring the |
The entity that leads to the generated syntax error is DenormalizedPayables: https://github.tools.sap/erp4sme/crypto-for-business/blob/c05a6d6c8c89f2a4918803a4e996b7e5485d2e85/db/payment/payables/Payables.cds#L53 This entity contains the element "Integration", which is defined from Payables.Integration.name: https://github.tools.sap/erp4sme/crypto-for-business/blob/c05a6d6c8c89f2a4918803a4e996b7e5485d2e85/db/payment/payables/Payables.cds#L70 The entity , where DenormalizedPayables bases on, is Payables: https://github.tools.sap/erp4sme/crypto-for-business/blob/c05a6d6c8c89f2a4918803a4e996b7e5485d2e85/db/payment/payables/Payables.cds#L20 I assume that these two "Integrations" are somehow merged within the generation into the same class leading to the clash. However, I don't understand why. The entity DenormalizedPayables contains as the only element "Integration" the one being a string. |
Hi Stefan, thanks for the report and the detailed analysis. Best, Footnotes
|
Hi Daniel
I have pushed the generation result in case you also want to have a look at it: https://github.tools.sap/erp4sme/crypto-for-business/tree/switch-to-cds-typer-payment-master-data/%40cds-models The errors mentioned above in the following file still exist:
I assume that your correction was not meant to solve these as well. Can you please check and let me know if I shall open again a separate bug for this? Thank you, PS: Thank you for the new method to try out prerelease versions! By far more convenient! |
Hi Stefan, glad we could (at least partially) resolve your issue! I checked the remaining issue you found and it seems to be something else entirely. So if you wouldn't mind opening a new issue for that, that would be greatly appreciated! I could then just merge the fix for views, which will automatically close this issue here. (On a side note: we consider the types generated by cds-typer to be ephemeral and therefore recommend not checking them into your VCS, but generate them on-site. You may have good reasons to persist the types in your repository, just wanted to mention it.) Best, |
Thank you again for the fix! I have created #288 as follow-up for the remaining issue. I am aware that the generated types are ephemeral fro your point of view, and I will check if we finally exclude them from version control. |
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
In our project some generated files by cds typer contan syntax errors.
In detail
The error
Property 'Integration' in type '(Anonymous class)' is not assignable to the same property in base type '_cuidAspect<{ new (...args: any[]): _managedAspect<{ new (...args: any[]): _SourceReferenceAspect<TBase>.(Anonymous class); prototype: _SourceReferenceAspect<any>.(Anonymous class); readonly actions: Record<...>; } & TBase>.(Anonymous class); prototype: _managedAspect<...>.(Anonymous class); readonly actions: Record...'. Type 'string' has no properties in common with type 'Integration'.
occurs in the files
Several additional errors, like e.g.
Cannot redeclare exported variable '_PaymentAgreementOutgoingAspect'.
Cannot redeclare exported variable '_PaymentAgreementIncomingAspect'.
Class 'PaymentAgreementIncoming' used before its declaration.
occur in the file
Expected Behavior
No syntax errors in generated files
Steps To Reproduce
repo https://github.tools.sap/erp4sme/crypto-for-business
branch switch-to-cds-typer-payment-master-data
above-mentioned files are located in https://github.tools.sap/erp4sme/crypto-for-business/tree/switch-to-cds-typer-payment-master-data/%40cds-models)
to re-generate the files run npm run cds-typer:dev
Environment
Repository Containing a Minimal Reproducible Example
No response
Anything else?
This is a follow-up of #270
The text was updated successfully, but these errors were encountered: