Skip to content
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

Error when applying class mixins in 2.3-dev #14209

Closed
justinfagnani opened this issue Feb 21, 2017 · 2 comments
Closed

Error when applying class mixins in 2.3-dev #14209

justinfagnani opened this issue Feb 21, 2017 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@justinfagnani
Copy link

TypeScript Version: 2.3.0-dev.20170221

Code

export interface Foo { foo(): string; }

export type Constructor<T extends object> = new (...args: any[]) => T;

export const Foo =
    <T extends Constructor<{}>>(superclass: T): Constructor<Foo>& T =>
        class extends superclass implements Foo {
  foo() {
    return 'baz';
  }
}

export class Bar extends Foo(Object) {
}

Expected behavior:
no errors

Actual behavior:

[ts] 'extends' clause of exported class 'Bar' refers to a type whose name cannot be referenced.
@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Feb 22, 2017

To note, this shows up because you have --declaration set. Unfortunately you'll need to write out the exact type to get rid of the error.

I think there are two issues:

  1. This error doesn't signal that --declaration is part of the cause.
  2. This makes using mixin classes cumbersome.

(2) is something I've definitely noticed, but I don't know how much of a problem it will tend to be.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 22, 2017

Here is the issue tracking @DanielRosenwasser's point (2): #14075

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants