mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-16 15:51:35 -05:00
Fix bug: don't return string literal completions if there's no contextual type (#23079)
This commit is contained in:
@@ -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();
|
||||
Reference in New Issue
Block a user