@@ -241,7 +241,7 @@ namespace ts.Completions.StringCompletions {
241
241
// Get string literal completions from specialized signatures of the target
242
242
// i.e. declare function f(a: 'A');
243
243
// f("/*completion position*/")
244
- return argumentInfo ? getStringLiteralCompletionsFromSignature ( argumentInfo . invocation , node , argumentInfo , typeChecker ) : fromContextualType ( ) ;
244
+ return argumentInfo && getStringLiteralCompletionsFromSignature ( argumentInfo . invocation , node , argumentInfo , typeChecker ) || fromContextualType ( ) ;
245
245
}
246
246
// falls through (is `require("")` or `require(""` or `import("")`)
247
247
@@ -283,7 +283,7 @@ namespace ts.Completions.StringCompletions {
283
283
type !== current && isLiteralTypeNode ( type ) && isStringLiteral ( type . literal ) ? type . literal . text : undefined ) ;
284
284
}
285
285
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 {
287
287
let isNewIdentifier = false ;
288
288
const uniques = new Map < string , true > ( ) ;
289
289
const candidates : Signature [ ] = [ ] ;
@@ -301,8 +301,7 @@ namespace ts.Completions.StringCompletions {
301
301
isNewIdentifier = isNewIdentifier || ! ! ( type . flags & TypeFlags . String ) ;
302
302
return getStringLiteralTypes ( type , uniques ) ;
303
303
} ) ;
304
-
305
- return { kind : StringLiteralCompletionKind . Types , types, isNewIdentifier } ;
304
+ return length ( types ) ? { kind : StringLiteralCompletionKind . Types , types, isNewIdentifier } : undefined ;
306
305
}
307
306
308
307
function stringLiteralCompletionsFromProperties ( type : Type | undefined ) : StringLiteralCompletionsFromProperties | undefined {
0 commit comments