fix(55500): Incorrect error reported when using class extends null and re-opening interface
This commit is contained in:
Родитель
763b5ebfd4
Коммит
1dffcd6692
|
@ -44656,8 +44656,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
|||
if (!checkTypeAssignableTo(typeWithThis, baseWithThis, /*errorNode*/ undefined)) {
|
||||
issueMemberSpecificError(node, typeWithThis, baseWithThis, Diagnostics.Class_0_incorrectly_extends_base_class_1);
|
||||
}
|
||||
else {
|
||||
// Report static side error only when instance type is assignable
|
||||
else if (staticBaseType !== nullWideningType) {
|
||||
// Report static side error only when instance type is assignable and base type is not null
|
||||
checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1);
|
||||
}
|
||||
if (baseConstructorType.flags & TypeFlags.TypeVariable) {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
classExtendsNull2.ts(5,7): error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'null'.
|
||||
classExtendsNull2.ts(7,5): error TS17005: A constructor cannot contain a 'super' call when its class extends 'null'.
|
||||
|
||||
|
||||
==== classExtendsNull2.ts (2 errors) ====
|
||||
==== classExtendsNull2.ts (1 errors) ====
|
||||
// https://github.com/microsoft/TypeScript/issues/55499
|
||||
|
||||
interface Base {}
|
||||
|
||||
class C extends null {
|
||||
~
|
||||
!!! error TS2417: Class static side 'typeof C' incorrectly extends base class static side 'null'.
|
||||
constructor() {
|
||||
super();
|
||||
~~~~~~~
|
||||
|
|
Загрузка…
Ссылка в новой задаче