Fix bug: don't return string literal completions if there's no contextual type (#23079)

This commit is contained in:
Andy authored and GitHub committed 2018-04-02 16:20:51 -07:00
1 parent 5a32fb0b07
commit d07102e567
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -388,7 +388,7 @@ namespace ts.Completions {
// '/*completion position*/'
// });
const type = typeChecker.getContextualType(node.parent.parent);
return { kind: StringLiteralCompletionKind.Properties, symbols: type && type.getApparentProperties() };
return type && { kind: StringLiteralCompletionKind.Properties, symbols: type.getApparentProperties() };
}
return fromContextualType();
@@ -0,0 +1,8 @@
/// <reference path="fourslash.ts" />
////const x = { "/**/" };
// We specifically filter out any array-like types.
// Private members will be excluded by `createUnionOrIntersectionProperty`.
goTo.marker("");
verify.completionListIsEmpty();