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

Nonsensical error when creating a mixin with a type parameter #59411

Closed
STRd6 opened this issue Jul 24, 2024 · 2 comments
Closed

Nonsensical error when creating a mixin with a type parameter #59411

STRd6 opened this issue Jul 24, 2024 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@STRd6
Copy link

STRd6 commented Jul 24, 2024

πŸ”Ž Search Terms

"mixin type parameter"

πŸ•— Version & Regression Information

At least since v3.3.3

⏯ Playground Link

No response

πŸ’» Code

type Constructor<T = {}> = new (
  ...args: any[]
) => T;

export const Undo = <Base extends Constructor>(
  S: Base,
) => {
  abstract class C<T> extends S {
    constructor(...args: any[]) {
      super(...args)
    }
    abstract f(x: T): T
  }

  return C;
};

πŸ™ Actual behavior

A mixin class must have a constructor with a single rest parameter of type 'any[]'.(2545)
class C<T>

πŸ™‚ Expected behavior

An error message explaining that mixins can't have type parameters since it already has a constructor function with a rest parameter of type any[].

Additional information about the issue

No response

@jcalz
Copy link
Contributor

jcalz commented Jul 24, 2024

duplicate #37142

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Jul 29, 2024
@typescript-bot
Copy link
Collaborator

This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@typescript-bot typescript-bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants