mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 22:55:36 -05:00
Annotate fewer extracted constants with types
Expose `isContextSensitive` from the checker and omit type annotations for expressions for which it returns false.
This commit is contained in:
@@ -1004,7 +1004,7 @@ namespace ts.refactor.extractSymbol {
|
||||
const localNameText = getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file.text);
|
||||
const isJS = isInJavaScriptFile(scope);
|
||||
|
||||
const variableType = isJS
|
||||
const variableType = isJS || !checker.isContextSensitive(node)
|
||||
? undefined
|
||||
: checker.typeToTypeNode(checker.getContextualType(node), scope, NodeBuilderFlags.NoTruncation);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user