|
6 | 6 | addRange, |
7 | 7 | addRelatedInfo, |
8 | 8 | addSyntheticLeadingComment, |
9 | | - addToSeen, |
10 | 9 | AliasDeclarationNode, |
11 | 10 | AllAccessorDeclarations, |
12 | 11 | AmbientModuleDeclaration, |
@@ -265,7 +264,6 @@ import { |
265 | 264 | getContainingClassStaticBlock, |
266 | 265 | getContainingFunction, |
267 | 266 | getContainingFunctionOrClassStaticBlock, |
268 | | - getContextualTypeFromParent, |
269 | 267 | getDeclarationModifierFlagsFromSymbol, |
270 | 268 | getDeclarationOfKind, |
271 | 269 | getDeclarationsOfKind, |
@@ -1755,7 +1753,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { |
1755 | 1753 | getTypeOfPropertyOfContextualType, |
1756 | 1754 | getFullyQualifiedName, |
1757 | 1755 | getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, CheckMode.Normal), |
1758 | | - getContextualStringLiteralCompletionTypes, |
1759 | 1756 | getCandidateSignaturesForStringLiteralCompletions, |
1760 | 1757 | getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, CheckMode.IsForSignatureHelp)), |
1761 | 1758 | getExpandedParameters, |
@@ -1931,23 +1928,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { |
1931 | 1928 | getSymbolFlags, |
1932 | 1929 | }; |
1933 | 1930 |
|
1934 | | - function getContextualStringLiteralCompletionTypes(expression: Expression) { |
1935 | | - const seen = new Map<string, true>(); |
1936 | | - |
1937 | | - return [ |
1938 | | - ...getStringLiteralTypes(getContextualTypeFromParent(expression, checker, ContextFlags.None), seen), |
1939 | | - ...getStringLiteralTypes(getContextualTypeFromParent(expression, checker, ContextFlags.Completions), seen), |
1940 | | - ]; |
1941 | | - } |
1942 | | - |
1943 | | - function getStringLiteralTypes(type: Type | undefined, uniques = new Map<string, true>()): readonly StringLiteralType[] { |
1944 | | - if (!type) return emptyArray; |
1945 | | - // skip constraint |
1946 | | - type = type.flags & TypeFlags.TypeParameter ? getBaseConstraintOfType(type) || type : type; |
1947 | | - return type.flags & TypeFlags.Union ? flatMap((type as UnionType).types, t => getStringLiteralTypes(t, uniques)) : |
1948 | | - type.flags & TypeFlags.StringLiteral && !(type.flags & TypeFlags.EnumLiteral) && addToSeen(uniques, (type as StringLiteralType).value) ? [type as StringLiteralType] : emptyArray; |
1949 | | - } |
1950 | | - |
1951 | 1931 | function getCandidateSignaturesForStringLiteralCompletions(call: CallLikeExpression, editingArgument: Node) { |
1952 | 1932 | const candidatesSet = new Set<Signature>(); |
1953 | 1933 | const candidates: Signature[] = []; |
@@ -31565,11 +31545,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { |
31565 | 31545 | case SyntaxKind.AmpersandAmpersandToken: |
31566 | 31546 | case SyntaxKind.CommaToken: |
31567 | 31547 | return node === right ? getContextualType(binaryExpression, contextFlags) : undefined; |
31568 | | - case SyntaxKind.EqualsEqualsEqualsToken: |
31569 | | - case SyntaxKind.EqualsEqualsToken: |
31570 | | - case SyntaxKind.ExclamationEqualsEqualsToken: |
31571 | | - case SyntaxKind.ExclamationEqualsToken: |
31572 | | - return getTypeOfExpression(node === right ? left : right); |
31573 | 31548 | default: |
31574 | 31549 | return undefined; |
31575 | 31550 | } |
@@ -32153,13 +32128,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { |
32153 | 32128 | return getContextualTypeForAwaitOperand(parent as AwaitExpression, contextFlags); |
32154 | 32129 | case SyntaxKind.CallExpression: |
32155 | 32130 | case SyntaxKind.NewExpression: |
32156 | | - if (node === (parent as CallExpression | NewExpression).expression) { |
32157 | | - if (getImmediatelyInvokedFunctionExpression(skipParentheses(node))) { |
32158 | | - // iifes themselves can't be contextually-typed (unlike their parameters) |
32159 | | - return undefined; |
32160 | | - } |
32161 | | - return getContextualType(parent as CallExpression | NewExpression, contextFlags); |
32162 | | - } |
32163 | 32131 | return getContextualTypeForArgument(parent as CallExpression | NewExpression, node); |
32164 | 32132 | case SyntaxKind.Decorator: |
32165 | 32133 | return getContextualTypeForDecorator(parent as Decorator); |
|
0 commit comments