-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Base constructor return type 'object' is not a class or interface type. #13975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Using TS 2.2.0 (Release Candidate) the follow works as expected: type Constructable = new (...args: any[]) => object;
function Timestamped<BC extends Constructable>(Base: BC) {
return class extends Base {
timestamp = new Date();
};
}
class MyClass { }
const result = new (Timestamped(MyClass))();
// prints timestamp
console.log(result.timestamp); |
Tried from scratch:
What I get is:
Do I need to add a tsconfig? Some special options? |
Are you sure that |
Also, tried with both |
This is a duplicate of #13805. The fix for this issue was not included in |
Ha sorry I was actually using |
Why is it not going to be included in 2.2.0? Can you not make an rc1 that includes the fix? |
The next release is |
Uh oh!
There was an error while loading. Please reload this page.
TypeScript Version: 2.2.0
Got this example from the 2.2 announcement
Code
Expected behavior:
Extend my class with a timestamp.
Actual behavior:
Not compiling with error: "Base constructor return type 'object' is not a class or interface type."
The text was updated successfully, but these errors were encountered: