cap-js / cds-typer

CDS type generator for JavaScript
Apache License 2.0
29 stars 10 forks source link

[error TS2612: Property '' will overwrite the base property in #286

Closed Sandeep-Malhotra closed 3 months ago

Sandeep-Malhotra commented 3 months ago

Is there an existing issue for this?

Nature of Your Project

TypeScript

Current Behavior

Error error TS2612: Property 'ID' will overwrite the base property in '_cuidAspect<{ new (...args: any[]): _managedAspect.managed; prototype: _managedAspect.managed; readonly actions: Record<never, never>; } & TBase>.cuid & _managedAspect.managed & object'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

Entity Definition in service file

 entity ShiftHeaders         as
        projection on db.ShiftHeader {
            *
        }
        excluding {
            createdAt,
            createdBy,
            modifiedAt,
            modifiedBy
        };

Entity defined in db file

entity ShiftHeader : cuid, managed {
    nextCursor     :      db.WorkForceCursor;
    updateSequence :      Composition[1, * ] of ShiftRecord
                              on updateSequence.updateSequenceId = ID;
    errors         : many db.WorkforceError;
    warnings       : many db.WorkForceWarning;

}

Type generated in index.ts

export function _ShiftHeaderAspect<TBase extends new (...args: any[]) => object>(Base: TBase) {
  return class ShiftHeader extends _._cuidAspect(_._managedAspect(Base)) {
        ID?: string;
        nextCursor?: _stce_api.WorkForceCursor | null;
        updateSequence?: __.Composition.of.many<ShiftRecord_>;
        errors?: Array<_stce_api.WorkforceError>;
        warnings?: Array<_stce_api.WorkForceWarning>;
      static readonly actions: Record<never, never>
  };
}

Expected Behavior

Types must be generated without error

Steps To Reproduce

No response

Environment

- **OS**:
- **Node**:
- **npm**:
- **cds-typer**: 
- **cds**:

Repository Containing a Minimal Reproducible Example

No response

Anything else?

No response

daogrady commented 3 months ago

Duplicate of https://github.com/cap-js/cds-typer/issues/274