mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 02:15:10 -05:00
Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end (#43645)
* Fix getCodeFixesAtPosition for ts(2339) thows error False expression: Token end is child end Fixes #43191 * Add test
This commit is contained in:
@@ -276,11 +276,11 @@ namespace ts.codefix {
|
||||
const binaryExpression = token.parent.parent as BinaryExpression;
|
||||
const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
|
||||
const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
|
||||
typeNode = checker.typeToTypeNode(widenedType, classDeclaration, /*flags*/ undefined);
|
||||
typeNode = checker.typeToTypeNode(widenedType, classDeclaration, NodeBuilderFlags.NoTruncation);
|
||||
}
|
||||
else {
|
||||
const contextualType = checker.getContextualType(token.parent as Expression);
|
||||
typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, /*flags*/ undefined) : undefined;
|
||||
typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, NodeBuilderFlags.NoTruncation) : undefined;
|
||||
}
|
||||
return typeNode || factory.createKeywordTypeNode(SyntaxKind.AnyKeyword);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user