mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Type parameters from class should not be in scope in base class expression
This commit is contained in:
+11
-1
@@ -1016,7 +1016,17 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
if (lastLocation === (<ExpressionWithTypeArguments>location).expression && (<HeritageClause>location.parent).token === SyntaxKind.ExtendsKeyword) {
|
||||
const container = location.parent.parent;
|
||||
if (isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & SymbolFlags.Type))) {
|
||||
if (nameNotFoundMessage) {
|
||||
error(errorLocation, Diagnostics.Base_class_expressions_cannot_reference_class_type_parameters);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
break;
|
||||
// It is not legal to reference a class's own type parameters from a computed property name that
|
||||
// belongs to the class. For example:
|
||||
//
|
||||
|
||||
@@ -1912,6 +1912,10 @@
|
||||
"category": "Error",
|
||||
"code": 2560
|
||||
},
|
||||
"Base class expressions cannot reference class type parameters.": {
|
||||
"category": "Error",
|
||||
"code": 2561
|
||||
},
|
||||
"JSX element attributes type '{0}' may not be a union type.": {
|
||||
"category": "Error",
|
||||
"code": 2600
|
||||
|
||||
Reference in New Issue
Block a user