Microsoft/TypeScript
Vedi su GitHubTS is overly picky when declaring a class constructor type
Open
#29.707 aperta il 3 feb 2019
BugDomain: classesGood First IssueHelp Wanted
Metriche repository
- Star
- (48.455 star)
- Metriche merge PR
- (Merge medio 6g 17h) (9 PR mergiate in 30 g)
Descrizione
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]