Skip to content

Unable to do mixin with private property #7387

@unional

Description

@unional

TypeScript Version:
1.8.7

Code

// A self-contained demonstration of the problem follows...
class A {
  public propA; any = {};
  private propB: number = 1;
}

class B implements A {
  public propA: any;
  private propB: number;  // here
}
applyMixin(A, [B]);

Expected behavior:
Compile success

Actual behavior:
Compile failed.
When private propB: number; exists, tsc failed with:

error TS2420: Class 'A' incorrectly implements interface 'B'.
  Types have separate declarations of a private property 'propB'.`

When private propB: number; is removed, tsc failed with:

error TS2420: Class 'A' incorrectly implements interface 'B'.
  Property 'propB' is missing in Type 'A'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions