mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-12 20:01:02 -05:00
fix(49993): skip the quick fix for an expression with an enum type (#50625)
This commit is contained in:
@@ -257,7 +257,7 @@ namespace ts.codefix {
|
||||
}
|
||||
|
||||
const enumDeclaration = find(symbol.declarations, isEnumDeclaration);
|
||||
if (enumDeclaration && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
||||
if (enumDeclaration && !(leftExpressionType.flags & TypeFlags.EnumLike) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) {
|
||||
return { kind: InfoKind.Enum, token, parentDeclaration: enumDeclaration };
|
||||
}
|
||||
|
||||
|
||||
7
tests/cases/fourslash/codeFixAddMissingEnumMember13.ts
Normal file
7
tests/cases/fourslash/codeFixAddMissingEnumMember13.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////enum E { A, B }
|
||||
////declare var a: E;
|
||||
////a.C;
|
||||
|
||||
verify.not.codeFixAvailable("fixMissingMember");
|
||||
Reference in New Issue
Block a user