Skip to content

The add missing enum member quick fix shouldn't add new member to the enum if it's dotting off of a value whose type is enumΒ #49993

@danay1999

Description

@danay1999

Bug Report

πŸ”Ž Search Terms

enum is missing member, property does not exist on type

πŸ•— Version & Regression Information

  • 4.8.0-beta (playground)
  • 4.7.4 (playground)
  • 4.6.2 (locally)
  • 3.3.3333 (playground)

⏯ Playground Link

https://www.typescriptlang.org/play?ts=4.8.0-dev.20220721#code/KYOwrgtgBAolDeAoAggGgEKoMKsQX0QBNgBjAGwEMAnYKAN2qmAC5ZFgA6AIwoC8oA9AIAKVAPYAHYFQAuATygByHr0VRCY4AGcoIMTKYAPAJZaDYkFHlSlMRRyA

πŸ’» Code

enum E {
A,B,C,
}
declare var e: E
e.baz //Property 'baz' does not exist on type 'E'

πŸ™ Actual behavior

Error Property 'baz' does not exist on type 'E' is shown and the quick fix recommended is Add missing enum member 'baz' but dotting off of a value whose type is enum shouldn't be a candidate for another member to put on that enum.

πŸ™‚ Expected behavior

quick fix is not recommended.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions