KEMBAR78
Use 'abstract new' in InstanceType and ConstructorParameters by rbuckton · Pull Request #43380 · microsoft/TypeScript · GitHub
Skip to content

Conversation

@rbuckton
Copy link
Contributor

This finishes up the remaining work from #36392 to update ConstructorParameters and InstanceType to use abstract constructor types so that you can retrieve parameter lists and instance types from abstract classes:

abstract class C {
  constructor(x: number) {}
}

// before: error
// after: [x: number]
type P = ConstructorParameters<C>;

// before: error
// after: C
type I = InstanceType<C>;

@rbuckton
Copy link
Contributor Author

Looks like we still need to update typescript-eslint. Fix for that is up in #43381

Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine, but it looks like our linter does need to get its deps updated first.

@rbuckton
Copy link
Contributor Author

This looks fine, but it looks like our linter does need to get its deps updated first.

That's what #43381 is for.

@rbuckton rbuckton merged commit e10a325 into master Mar 25, 2021
@rbuckton rbuckton deleted the use-abstract-new branch March 25, 2021 22:27
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants