Microsoft/TypeScript
View on GitHubTS is overly picky when declaring a class constructor type
Open
#29,707 opened on Feb 3, 2019
BugDomain: classesGood First IssueHelp Wanted
Repository metrics
- Stars
- (48,455 stars)
- PR merge metrics
- (Avg merge 6d 17h) (9 merged PRs in 30d)
Description
TypeScript Version: 3.4.0-dev.20190202
Search Terms: class, extend, constructor, any[]
Code
type ClassConstructor = new(...args: any[]) => {}
function mixin<C extends ClassConstructor>(Class: C) {
return class extends Class {}
}
Expected behavior:
I should be able to replace ...args: any[] with ...args: unknown[], or any other signature.
Actual behavior:
Error: Type 'C' is not a constructor function type. [2507]