@@ -3190,9 +3190,11 @@ namespace ts {
3190
3190
return type.flags & TypeFlags.Union ? getPropertiesOfUnionType(<UnionType>type) : getPropertiesOfObjectType(type);
3191
3191
}
3192
3192
3193
- // For a type parameter, return the base constraint of the type parameter. For the string, number,
3194
- // boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
3195
- // type itself. Note that the apparent type of a union type is the union type itself.
3193
+ /**
3194
+ * For a type parameter, return the base constraint of the type parameter. For the string, number,
3195
+ * boolean, and symbol primitive types, return the corresponding object types. Otherwise return the
3196
+ * type itself. Note that the apparent type of a union type is the union type itself.
3197
+ */
3196
3198
function getApparentType(type: Type): Type {
3197
3199
if (type.flags & TypeFlags.Union) {
3198
3200
type = getReducedTypeOfUnionType(<UnionType>type);
@@ -8403,7 +8405,10 @@ namespace ts {
8403
8405
}
8404
8406
8405
8407
// If the expression is of abstract type, then it cannot be instantiated.
8406
- let valueDecl = expressionType.symbol && expressionType.symbol.valueDeclaration;
8408
+ // Note, only class declarations can be declared abstract.
8409
+ // In the case of a merged class-module or class-interface declaration,
8410
+ // only the class declaration node will have the Abstract flag set.
8411
+ let valueDecl = expressionType.symbol && getDeclarationOfKind(expressionType.symbol, SyntaxKind.ClassDeclaration);
8407
8412
if (valueDecl && valueDecl.flags & NodeFlags.Abstract) {
8408
8413
error(node, Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, declarationNameToString(valueDecl.name));
8409
8414
}
@@ -10253,7 +10258,8 @@ namespace ts {
10253
10258
}
10254
10259
10255
10260
// Abstract methods can't have an implementation -- in particular, they don't need one.
10256
- if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract) ) {
10261
+ if (!isExportSymbolInsideModule && lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body &&
10262
+ !(lastSeenNonAmbientDeclaration.flags & NodeFlags.Abstract) ) {
10257
10263
reportImplementationExpectedError(lastSeenNonAmbientDeclaration);
10258
10264
}
10259
10265
@@ -11699,6 +11705,9 @@ namespace ts {
11699
11705
Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration.");
11700
11706
11701
11707
if (derived) {
11708
+ // In order to resolve whether the inherited method was overriden in the base class or not,
11709
+ // we compare the Symbols obtained. Since getTargetSymbol returns the symbol on the *uninstantiated*
11710
+ // type declaration, derived and base resolve to the same symbol even in the case of generic classes.
11702
11711
if (derived === base) {
11703
11712
// derived class inherits base without override/redeclaration
11704
11713
0 commit comments