@@ -422,7 +422,7 @@ namespace ts.Completions {
422
422
case SyntaxKind . CallExpression :
423
423
case SyntaxKind . NewExpression :
424
424
if ( ! isRequireCall ( node . parent , /*checkArgumentIsStringLiteralLike*/ false ) && ! isImportCall ( node . parent ) ) {
425
- const argumentInfo = SignatureHelp . getImmediatelyContainingArgumentInfo ( node , position , sourceFile ) ;
425
+ const argumentInfo = SignatureHelp . getArgumentInfoForCompletions ( node , position , sourceFile ) ;
426
426
// Get string literal completions from specialized signatures of the target
427
427
// i.e. declare function f(a: 'A');
428
428
// f("/*completion position*/")
@@ -452,15 +452,15 @@ namespace ts.Completions {
452
452
}
453
453
}
454
454
455
- function getStringLiteralCompletionsFromSignature ( argumentInfo : SignatureHelp . ArgumentListInfo , checker : TypeChecker ) : StringLiteralCompletionsFromTypes {
455
+ function getStringLiteralCompletionsFromSignature ( argumentInfo : SignatureHelp . ArgumentInfoForCompletions , checker : TypeChecker ) : StringLiteralCompletionsFromTypes {
456
456
let isNewIdentifier = false ;
457
457
458
458
const uniques = createMap < true > ( ) ;
459
459
const candidates : Signature [ ] = [ ] ;
460
460
checker . getResolvedSignature ( argumentInfo . invocation , candidates , argumentInfo . argumentCount ) ;
461
461
const types = flatMap ( candidates , candidate => {
462
462
if ( ! candidate . hasRestParameter && argumentInfo . argumentCount > candidate . parameters . length ) return ;
463
- const type = checker . getParameterType ( candidate , argumentInfo . argumentIndex ! ) ; // TODO: GH#18217
463
+ const type = checker . getParameterType ( candidate , argumentInfo . argumentIndex ) ;
464
464
isNewIdentifier = isNewIdentifier || ! ! ( type . flags & TypeFlags . String ) ;
465
465
return getStringLiteralTypes ( type , checker , uniques ) ;
466
466
} ) ;
@@ -720,10 +720,10 @@ namespace ts.Completions {
720
720
case SyntaxKind . OpenBraceToken :
721
721
return isJsxExpression ( parent ) && parent . parent . kind !== SyntaxKind . JsxElement ? checker . getContextualTypeForJsxAttribute ( parent . parent ) : undefined ;
722
722
default :
723
- const argInfo = SignatureHelp . getImmediatelyContainingArgumentInfo ( currentToken , position , sourceFile ) ;
723
+ const argInfo = SignatureHelp . getArgumentInfoForCompletions ( currentToken , position , sourceFile ) ;
724
724
return argInfo
725
725
// At `,`, treat this as the next argument after the comma.
726
- ? checker . getContextualTypeForArgumentAtIndex ( argInfo . invocation , argInfo . argumentIndex ! + ( currentToken . kind === SyntaxKind . CommaToken ? 1 : 0 ) ) // TODO: GH#18217
726
+ ? checker . getContextualTypeForArgumentAtIndex ( argInfo . invocation , argInfo . argumentIndex + ( currentToken . kind === SyntaxKind . CommaToken ? 1 : 0 ) )
727
727
: isEqualityOperatorKind ( currentToken . kind ) && isBinaryExpression ( parent ) && isEqualityOperatorKind ( parent . operatorToken . kind )
728
728
// completion at `x ===/**/` should be for the right side
729
729
? checker . getTypeAtLocation ( parent . left )
0 commit comments