Merge pull request #16059 from Microsoft/mappedTypeDeclarations

Set '.declarations' on a property of a homomorphic mapped type
This commit is contained in:
Andy
2017-05-25 09:43:36 -07:00
committed by GitHub
9 changed files with 70 additions and 42 deletions

View File

@@ -5692,6 +5692,7 @@ namespace ts {
prop.type = propType;
if (propertySymbol) {
prop.syntheticOrigin = propertySymbol;
prop.declarations = propertySymbol.declarations;
}
members.set(propName, prop);
}

View File

@@ -650,10 +650,12 @@ namespace ts.FindAllReferences.Core {
// If this is private property or method, the scope is the containing class
if (flags & (SymbolFlags.Property | SymbolFlags.Method)) {
const privateDeclaration = find(declarations, d => !!(getModifierFlags(d) & ModifierFlags.Private));
const privateDeclaration = find(declarations, d => hasModifier(d, ModifierFlags.Private));
if (privateDeclaration) {
return getAncestor(privateDeclaration, SyntaxKind.ClassDeclaration);
}
// Else this is a public property and could be accessed from anywhere.
return undefined;
}
// If symbol is of object binding pattern element without property name we would want to
@@ -669,11 +671,6 @@ namespace ts.FindAllReferences.Core {
return undefined;
}
// If this is a synthetic property, it's a property and must be searched for globally.
if ((flags & SymbolFlags.Transient && (<TransientSymbol>symbol).checkFlags & CheckFlags.Synthetic)) {
return undefined;
}
let scope: Node | undefined;
for (const declaration of declarations) {
const container = getContainerNode(declaration);