Skip to content

Commit 7a3de81

Browse files
authoredSep 21, 2022
fix(49993): skip the quick fix for an expression with an enum type (#50625)
1 parent 2644f28 commit 7a3de81

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎src/services/codefixes/fixAddMissingMember.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace ts.codefix {
257257
}
258258

259259
const enumDeclaration = find(symbol.declarations, isEnumDeclaration);
260-
if (enumDeclaration && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
260+
if (enumDeclaration && !(leftExpressionType.flags & TypeFlags.EnumLike) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
261261
return { kind: InfoKind.Enum, token, parentDeclaration: enumDeclaration };
262262
}
263263

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
////enum E { A, B }
4+
////declare var a: E;
5+
////a.C;
6+
7+
verify.not.codeFixAvailable("fixMissingMember");

0 commit comments

Comments
 (0)