Skip to content

A Constructor within a ReadonlyDeep type is not callable #592

@galmalka

Description

@galmalka

Given the following code:

class A {}

const x = {
    constructor: A
}

const readonlyX: ReadonlyDeep<typeof x> = x;

const y = new readonlyX.constructor();

The last line gives the following error:
This expression is not constructable. Type 'ReadonlyObjectDeep<typeof A>' has no construct signatures.ts(2351)

This should probably be legitimate because using the constructor doesn't change the variable itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions