Skip to content

Can't concat ReadonlyArray #17076

Closed
Closed
@ghost

Description

TypeScript Version: nightly (2.5.0-dev.20170707)

Code

const x: ReadonlyArray<number> = [0];
x.concat(x);

Expected behavior:

No error.

Actual behavior:

src/a.ts(2,10): error TS2345: Argument of type 'ReadonlyArray<number>' is not assignable to parameter of type 'number | number[]'.
  Type 'ReadonlyArray<number>' is not assignable to type 'number[]'.
    Property 'push' is missing in type 'ReadonlyArray<number>'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions