Skip to content

Commit 7465f04

Browse files
authored
fix(48542): omit parameter info of contextual union type (#48549)
1 parent e02998f commit 7465f04

File tree

3 files changed

+446
-3
lines changed

3 files changed

+446
-3
lines changed

src/services/signatureHelp.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,13 @@ namespace ts.SignatureHelp {
307307
// for optional function condition.
308308
const nonNullableContextualType = contextualType.getNonNullableType();
309309

310-
const signatures = nonNullableContextualType.getCallSignatures();
311-
if (signatures.length !== 1) return undefined;
310+
const symbol = nonNullableContextualType.symbol;
311+
if (symbol === undefined) return undefined;
312312

313-
const invocation: ContextualInvocation = { kind: InvocationKind.Contextual, signature: first(signatures), node: startingToken, symbol: chooseBetterSymbol(nonNullableContextualType.symbol) };
313+
const signature = lastOrUndefined(nonNullableContextualType.getCallSignatures());
314+
if (signature === undefined) return undefined;
315+
316+
const invocation: ContextualInvocation = { kind: InvocationKind.Contextual, signature, node: startingToken, symbol: chooseBetterSymbol(symbol) };
314317
return { isTypeParameterList: false, invocation, argumentsSpan, argumentIndex, argumentCount };
315318
}
316319

0 commit comments

Comments
 (0)