Skip to content

impossible to make idColumn/jsonAttributes **readonly** #2745

@salisbury-espinosa

Description

@salisbury-espinosa
static get idColumn() {
    return ['id'] as const;
}

=>

TS2417: Class static side typeof Base incorrectly extends base class static side typeof Model
Types of property idColumn are incompatible.
Type string | readonly string[] is not assignable to type string | string[]
Type readonly string[] is not assignable to type string | string[]
The type readonly string[] is readonly and cannot be assigned to the mutable type string[

cause https://github.com/Vincit/objection.js/blob/main/typings/objection/index.d.ts#L1554

  export class Model {
    static idColumn: string | string[];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions