@@ -422,7 +422,7 @@ namespace ts.Completions {
422422 case SyntaxKind . CallExpression :
423423 case SyntaxKind . NewExpression :
424424 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 ) ;
426426 // Get string literal completions from specialized signatures of the target
427427 // i.e. declare function f(a: 'A');
428428 // f("/*completion position*/")
@@ -452,15 +452,15 @@ namespace ts.Completions {
452452 }
453453 }
454454
455- function getStringLiteralCompletionsFromSignature ( argumentInfo : SignatureHelp . ArgumentListInfo , checker : TypeChecker ) : StringLiteralCompletionsFromTypes {
455+ function getStringLiteralCompletionsFromSignature ( argumentInfo : SignatureHelp . ArgumentInfoForCompletions , checker : TypeChecker ) : StringLiteralCompletionsFromTypes {
456456 let isNewIdentifier = false ;
457457
458458 const uniques = createMap < true > ( ) ;
459459 const candidates : Signature [ ] = [ ] ;
460460 checker . getResolvedSignature ( argumentInfo . invocation , candidates , argumentInfo . argumentCount ) ;
461461 const types = flatMap ( candidates , candidate => {
462462 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 ) ;
464464 isNewIdentifier = isNewIdentifier || ! ! ( type . flags & TypeFlags . String ) ;
465465 return getStringLiteralTypes ( type , checker , uniques ) ;
466466 } ) ;
@@ -720,10 +720,10 @@ namespace ts.Completions {
720720 case SyntaxKind . OpenBraceToken :
721721 return isJsxExpression ( parent ) && parent . parent . kind !== SyntaxKind . JsxElement ? checker . getContextualTypeForJsxAttribute ( parent . parent ) : undefined ;
722722 default :
723- const argInfo = SignatureHelp . getImmediatelyContainingArgumentInfo ( currentToken , position , sourceFile ) ;
723+ const argInfo = SignatureHelp . getArgumentInfoForCompletions ( currentToken , position , sourceFile ) ;
724724 return argInfo
725725 // 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 ) )
727727 : isEqualityOperatorKind ( currentToken . kind ) && isBinaryExpression ( parent ) && isEqualityOperatorKind ( parent . operatorToken . kind )
728728 // completion at `x ===/**/` should be for the right side
729729 ? checker . getTypeAtLocation ( parent . left )
0 commit comments