mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-04 12:32:08 -06:00
fix(49993): skip the quick fix for an expression with an enum type (#50625)
This commit is contained in:
parent
2644f28677
commit
7a3de819bf
@ -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");
|
||||
Loading…
x
Reference in New Issue
Block a user