Closed tsteckenborn closed 1 month ago
TypeScript
Given the following:
service test { entity TestEntityEndingOnses { key id : String; testProperty1 : Composition of many TestEntityEndingOnses } }
leads to the following being generated:
// This is an automatically generated file. Please do not change its contents manually! import * as __ from './../_'; export default { name: 'test' } export function _TestEntityEndingOnsAspect<TBase extends new (...args: any[]) => object>(Base: TBase) { return class TestEntityEndingOns extends Base { id?: string; testProperty1?: __.Composition.of.many<TestEntityEndingOnses>; static readonly actions: Record<never, never> }; } export class TestEntityEndingOns extends _TestEntityEndingOnAspect(__.Entity) {} Object.defineProperty(TestEntityEndingOns, 'name', { value: 'test.TestEntityEndingOnses' }) export class TestEntityEndingOnses extends Array<TestEntityEndingOns> {$count?: number} Object.defineProperty(TestEntityEndingOnses, 'name', { value: 'test.TestEntityEndingOnses' })
Where in the line export class TestEntityEndingOns extends _TestEntityEndingOnAspect(__.Entity) {} it should be ...extends _TestEntityEndingOns<--....
export class TestEntityEndingOns extends _TestEntityEndingOnAspect(__.Entity) {}
...extends _TestEntityEndingOns<--...
It would have been expected that the generated types would be consistent and not incorrect.
See above.
- **OS**: MacOs - **Node**: 20.12.2 - **npm**: - **cds-typer**: 0.20.2 - **cds**: 7.8.2
No response
You can work around that by specifying the @singular on the respective entity.
@singular
Hi Tobias,
thanks for this report! I have prepared a fix which you can try on your actual model before I release it, if you would like.
Best, Daniel
Is there an existing issue for this?
Nature of Your Project
TypeScript
Current Behavior
Given the following:
leads to the following being generated:
Where in the line
export class TestEntityEndingOns extends _TestEntityEndingOnAspect(__.Entity) {}
it should be...extends _TestEntityEndingOns<--...
.Expected Behavior
It would have been expected that the generated types would be consistent and not incorrect.
Steps To Reproduce
See above.
Environment
Repository Containing a Minimal Reproducible Example
No response
Anything else?
You can work around that by specifying the
@singular
on the respective entity.