-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: classesBehavior of various `class` constructs, e.g. mixins or base classesBehavior of various `class` constructs, e.g. mixins or base classes
Milestone
Description
TypeScript Version: 4.2.0-dev.20210105, worked in v3.6.3, regressed in v3.7
Search Terms: is not a constructor function type
Expected behavior:
Error: Type 'typeof Base | typeof Base2' is not a constructor function type.
Or super should not be inferred as any.
Actual behavior:
No error and super: any
Related Issues:
Code
class Base {
prop = 1;
}
class Base2 {
other = 1;
}
const base = Boolean() ? Base : Base2;
class Derived extends base { // ExpressionWithTypeArguments is inferred as 'any', expected error "Type 'typeof Base | typeof Base2' is not a constructor function type."
static fn() {
super.wargarbl.wat; // super is inferred as 'any'
}
fn() {
super.wargarbl.wat; // super is inferred as 'any'
}
}Compiler Options
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictPropertyInitialization": true,
"strictBindCallApply": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"alwaysStrict": true,
"esModuleInterop": true,
"declaration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"moduleResolution": 2,
"target": "ES2017",
"jsx": "React",
"module": "ESNext"
}
}Playground Link: Provided
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: classesBehavior of various `class` constructs, e.g. mixins or base classesBehavior of various `class` constructs, e.g. mixins or base classes