mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
properly handle merged declarations across files
This commit is contained in:
@@ -2487,7 +2487,7 @@ namespace ts {
|
||||
// Every class automatically contains a static property member named 'prototype',
|
||||
// the type of which is an instantiation of the class type with type Any supplied as a type argument for each type parameter.
|
||||
// It is an error to explicitly declare a static property member with the name 'prototype'.
|
||||
const classType = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(prototype.parent));
|
||||
const classType = <InterfaceType>getDeclaredTypeOfSymbol(getParentOfSymbol(prototype));
|
||||
return classType.typeParameters ? createTypeReference(<GenericType>classType, map(classType.typeParameters, _ => anyType)) : classType;
|
||||
}
|
||||
|
||||
@@ -5803,8 +5803,8 @@ namespace ts {
|
||||
}
|
||||
else if (targetPropFlags & NodeFlags.Protected) {
|
||||
const sourceDeclaredInClass = sourceProp.parent && sourceProp.parent.flags & SymbolFlags.Class;
|
||||
const sourceClass = sourceDeclaredInClass ? <InterfaceType>getDeclaredTypeOfSymbol(sourceProp.parent) : undefined;
|
||||
const targetClass = <InterfaceType>getDeclaredTypeOfSymbol(targetProp.parent);
|
||||
const sourceClass = sourceDeclaredInClass ? <InterfaceType>getDeclaredTypeOfSymbol(getParentOfSymbol(sourceProp)) : undefined;
|
||||
const targetClass = <InterfaceType>getDeclaredTypeOfSymbol(getParentOfSymbol(targetProp));
|
||||
if (!sourceClass || !hasBaseType(sourceClass, targetClass)) {
|
||||
if (reportErrors) {
|
||||
reportError(Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2,
|
||||
@@ -8797,7 +8797,7 @@ namespace ts {
|
||||
*/
|
||||
function checkClassPropertyAccess(node: PropertyAccessExpression | QualifiedName, left: Expression | QualifiedName, type: Type, prop: Symbol): boolean {
|
||||
const flags = getDeclarationFlagsFromSymbol(prop);
|
||||
const declaringClass = <InterfaceType>getDeclaredTypeOfSymbol(getMergedSymbol(prop.parent));
|
||||
const declaringClass = <InterfaceType>getDeclaredTypeOfSymbol(getParentOfSymbol(prop));
|
||||
|
||||
if (left.kind === SyntaxKind.SuperKeyword) {
|
||||
const errorNode = node.kind === SyntaxKind.PropertyAccessExpression ?
|
||||
|
||||
Reference in New Issue
Block a user