Use discriminated unions to "branch" types for Property Names #1345
Labels
enhancement
New feature or request
package: typescript-estree
Issues related to @typescript-eslint/typescript-estree
Types for things like
ClassProperty
/MethodDefinition
/Property
, etc are pretty ugly.If the property name is computed, then any
Expression
is valid, otherwise onlyIdentifier | Literal
is valid.However we don't represent this in the types, we just have a single object with
key: Expression
.It'll be a bit of extra work, but we can improve upon this by doing something like:
Nodes we should do this for:
ClassProperty
TSAbstractClassProperty
MethodDefinition
TSAbstractMethodDefinition
Property
TSPropertySignature
TSMethodSignature
MemberExpression
OptionalMemberExpression
The text was updated successfully, but these errors were encountered: