@@ -241,7 +241,7 @@ namespace ts.Completions.StringCompletions {
241241 // Get string literal completions from specialized signatures of the target
242242 // i.e. declare function f(a: 'A');
243243 // f("/*completion position*/")
244- return argumentInfo ? getStringLiteralCompletionsFromSignature ( argumentInfo . invocation , node , argumentInfo , typeChecker ) : fromContextualType ( ) ;
244+ return argumentInfo && getStringLiteralCompletionsFromSignature ( argumentInfo . invocation , node , argumentInfo , typeChecker ) || fromContextualType ( ) ;
245245 }
246246 // falls through (is `require("")` or `require(""` or `import("")`)
247247
@@ -283,7 +283,7 @@ namespace ts.Completions.StringCompletions {
283283 type !== current && isLiteralTypeNode ( type ) && isStringLiteral ( type . literal ) ? type . literal . text : undefined ) ;
284284 }
285285
286- function getStringLiteralCompletionsFromSignature ( call : CallLikeExpression , arg : StringLiteralLike , argumentInfo : SignatureHelp . ArgumentInfoForCompletions , checker : TypeChecker ) : StringLiteralCompletionsFromTypes {
286+ function getStringLiteralCompletionsFromSignature ( call : CallLikeExpression , arg : StringLiteralLike , argumentInfo : SignatureHelp . ArgumentInfoForCompletions , checker : TypeChecker ) : StringLiteralCompletionsFromTypes | undefined {
287287 let isNewIdentifier = false ;
288288 const uniques = new Map < string , true > ( ) ;
289289 const candidates : Signature [ ] = [ ] ;
@@ -301,8 +301,7 @@ namespace ts.Completions.StringCompletions {
301301 isNewIdentifier = isNewIdentifier || ! ! ( type . flags & TypeFlags . String ) ;
302302 return getStringLiteralTypes ( type , uniques ) ;
303303 } ) ;
304-
305- return { kind : StringLiteralCompletionKind . Types , types, isNewIdentifier } ;
304+ return length ( types ) ? { kind : StringLiteralCompletionKind . Types , types, isNewIdentifier } : undefined ;
306305 }
307306
308307 function stringLiteralCompletionsFromProperties ( type : Type | undefined ) : StringLiteralCompletionsFromProperties | undefined {
0 commit comments