Skip to content

Can't cast array to array subtype #19873

@ghost

Description

TypeScript Version: 2.7.0-dev.20171109

Code

interface I extends Array<number> { x: number }
const x = [] as I;

Expected behavior:

No error.

Actual behavior:

src/a.ts(2,11): error TS2352: Type 'never[]' cannot be converted to type 'I'.
  Property 'x' is missing in type 'never[]'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions