Skip to content

Commit 1dffcd6

Browse files
committed
fix(55500): Incorrect error reported when using class extends null and re-opening interface
1 parent 763b5eb commit 1dffcd6

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44656,8 +44656,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4465644656
if (!checkTypeAssignableTo(typeWithThis, baseWithThis, /*errorNode*/ undefined)) {
4465744657
issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1);
4465844658
}
44659-
else {
44660-
// Report static side error only when instance type is assignable
44659+
else if (staticBaseType !== nullWideningType) {
44660+
// Report static side error only when instance type is assignable and base type is not null
4466144661
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
4466244662
}
4466344663
if (baseConstructorType.flags & TypeFlags.TypeVariable) {

tests/baselines/reference/classExtendsNull2.errors.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
classExtendsNull2.ts(5,7): error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'null'.
21
classExtendsNull2.ts(7,5): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'.
32

43

5-
==== classExtendsNull2.ts (2 errors) ====
4+
==== classExtendsNull2.ts (1 errors) ====
65
// https://github.com/microsoft/TypeScript/issues/55499
76

87
interface Base {}
98

109
class C extends null {
11-
~
12-
!!! error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'null'.
1310
constructor() {
1411
super();
1512
~~~~~~~

0 commit comments

Comments
 (0)