-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: ast-specIssues related to @typescript-eslint/ast-specIssues related to @typescript-eslint/ast-specpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree
Description
Before You File a Proposal Please Confirm You Have Done The Following...
- I have searched for related issues and found none that match my proposal.
- I have searched the current rule list and found no rules that match my proposal.
- I have read the FAQ and my problem is not listed.
Relevant Package
ast-spec
My proposal is suitable for this project
- I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).
Description
Currently TSLiteralType is typed to accept Literal | TemplateLiteral | UnaryExpression | UpdateExpression
| export interface TSLiteralType extends BaseNode { | |
| type: AST_NODE_TYPES.TSLiteralType; | |
| literal: LiteralExpression | UnaryExpression | UpdateExpression; | |
| } |
However this is unnecessarily permissive (playground):
- You cannot have
nullliterals -- that is instead aTSNullKeyword - You cannot have Regex literals -- they are currently a hard TS parser error
- You cannot have any
UnaryExpression-- the only allowable operator is-for negative numbers --type T = -1/type U = -1n - You cannot have any
UpdateExpressions --++and--are both hard TS parser errors
Proposal:
- Remove
UpdateExpressionfrom the type - Refine the
Literalunion to just the valid literals - Refine the
UnaryExpressionto just the valid operators
Additional Info
No response
Josh-Cena and kirkwaiblingerfisker
Metadata
Metadata
Assignees
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureaccepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: ast-specIssues related to @typescript-eslint/ast-specIssues related to @typescript-eslint/ast-specpackage: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree