import type { CallExpression } from "./call"; import type { VariableDeclaration } from "./declaration"; import type { Expression } from "./expression"; import type { VariableIdentifier } from "./identifier"; import type { Key } from "./key"; import type { MemberExpression } from "./member"; export type Pattern = | VariableIdentifier | MemberExpression | ObjectPattern | ArrayPattern | AssignmentPattern; export type DeclarablePattern = Pattern | VariableDeclaration; export type RestablePattern = RestElement | Pattern; export type UpdatePattern = VariableIdentifier | MemberExpression; export type CallablePattern = CallExpression | Pattern; export type CallableUpdatePattern = CallExpression | UpdatePattern; export type PatternProperty = | NonComputedPatternProperty | ComputedPatternProperty; export type RestablePatternProperty = PatternProperty | RestElement; export type NonComputedPatternProperty = X & { type: "Property"; key: Key; value: Pattern; kind: "init"; method: false; shorthand: boolean; computed: false; }; export type ComputedPatternProperty = X & { type: "Property"; key: Expression; value: Pattern; kind: "init"; method: false; shorthand: boolean; computed: true; }; export type RestElement = X & { type: "RestElement"; argument: Pattern; }; export type ObjectPattern = X & { type: "ObjectPattern"; properties: Array>; }; export type ArrayPattern = X & { type: "ArrayPattern"; elements: Array | RestElement | null>; }; export type AssignmentPattern = X & { type: "AssignmentPattern"; left: Pattern; right: Expression; };