mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
Merge pull request #18931 from amcasey/ExtractConstantThis
Allow Extract Constant into enclosing scope in spite of RangeFacts.UsesThis
This commit is contained in:
@@ -476,7 +476,10 @@ namespace ts.refactor.extractSymbol {
|
||||
// if range uses this as keyword or as type inside the class then it can only be extracted to a method of the containing class
|
||||
const containingClass = getContainingClass(current);
|
||||
if (containingClass) {
|
||||
return [containingClass];
|
||||
const containingFunction = findAncestor(current, isFunctionLikeDeclaration);
|
||||
return containingFunction
|
||||
? [containingFunction, containingClass]
|
||||
: [containingClass];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user