-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: RC (2.2.0)
Code
class Person {
constructor(public name: string) {}
protected myProtectedFunction() {
// do something
}
}
type Constructor<T> = new(...args: any[]) => T;
function PersonMixin<T extends Constructor<Person>>(Base: T) {
return class extends Base {
constructor(...args: any[]) {
super(...args);
}
myProtectedFunction() {
super.myProtectedFunction();
// do more things
}
};
}
class Customer extends PersonMixin(Person) {
accountBalance: number;
}Expected behavior:
No compilation errors
Actual behavior:
Errors with:
src/test.ts|24 col 7 error| Class 'Customer' incorrectly extends base class 'PersonMixin<typeof Person>.(Anonymous class) & Person'. Type 'Customer' is not assignable to type 'Person'. Property 'myProtectedFunction' is protected but type 'Customer' is not a class derived from 'Person'.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue