Skip to content

Commit be06338

Browse files
author
Andy
authored
Don't provide string literal completions for string enums (#18288)
* Don't provide string literal completions for string enums * Rename test
1 parent b84e6bc commit be06338

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ namespace ts.Completions {
284284
addStringLiteralCompletionsFromType(t, result, typeChecker, uniques);
285285
}
286286
}
287-
else if (type.flags & TypeFlags.StringLiteral) {
287+
else if (type.flags & TypeFlags.StringLiteral && !(type.flags & TypeFlags.EnumLiteral)) {
288288
const name = (<StringLiteralType>type).value;
289289
if (!uniques.has(name)) {
290290
uniques.set(name, true);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////const enum E {
4+
//// A = "A",
5+
////}
6+
////const e: E = "/**/";
7+
8+
goTo.marker("");
9+
verify.completionListIsEmpty();

0 commit comments

Comments
 (0)