chore: Update prettier v3.9 (#18147)

This commit is contained in:
liuxingbaoyu
2026-07-20 20:37:08 +02:00
committed by GitHub
parent da00d1273f
commit 26ff333af8
49 changed files with 129 additions and 319 deletions
+1 -5
View File
@@ -109,11 +109,7 @@ async function generateHelpers(
} }
type TypesHelperKind = type TypesHelperKind =
| "asserts" "asserts" | "ast-types" | "builders" | "constants" | "validators";
| "ast-types"
| "builders"
| "constants"
| "validators";
function generateTypeHelpers( function generateTypeHelpers(
helperKind: TypesHelperKind, helperKind: TypesHelperKind,
@@ -14,9 +14,10 @@ export default {
const scope = context.sourceCode.getScope(node); const scope = context.sourceCode.getScope(node);
const origin = getReferenceOrigin(callee, scope); const origin = getReferenceOrigin(callee, scope);
if ( if (!(
!(origin && (origin.kind === "import" || origin.kind === "property")) origin &&
) (origin.kind === "import" || origin.kind === "property")
))
return; return;
const { name } = origin; const { name } = origin;
@@ -24,9 +24,10 @@ export default {
const scope = context.sourceCode.getScope(node); const scope = context.sourceCode.getScope(node);
const origin = getReferenceOrigin(callee, scope); const origin = getReferenceOrigin(callee, scope);
if ( if (!(
!(origin && (origin.kind === "import" || origin.kind === "property")) origin &&
) (origin.kind === "import" || origin.kind === "property")
))
return; return;
const { name } = origin; const { name } = origin;
@@ -44,9 +44,7 @@ export default {
function functionVisitor( function functionVisitor(
node: ( node: (
| FunctionDeclaration FunctionDeclaration | FunctionExpression | ArrowFunctionExpression
| FunctionExpression
| ArrowFunctionExpression
) & ) &
Rule.NodeParentExtension, Rule.NodeParentExtension,
) { ) {
@@ -91,9 +91,7 @@ export default function getReferenceOrigin(
// @ts-expect-error upstream typing issue: https://github.com/eslint/eslint/pull/20798 // @ts-expect-error upstream typing issue: https://github.com/eslint/eslint/pull/20798
index: definition.index, index: definition.index,
functionNode: definition.node as ( functionNode: definition.node as (
| ArrowFunctionExpression ArrowFunctionExpression | FunctionDeclaration | FunctionExpression
| FunctionDeclaration
| FunctionExpression
) & ) &
Rule.NodeParentExtension, Rule.NodeParentExtension,
name: "", name: "",
@@ -188,8 +186,7 @@ function getPatternPath(node: Identifier & Rule.NodeParentExtension) {
} }
} while ( } while (
(current = current.parent.parent as (current = current.parent.parent as
| (Node & Rule.NodeParentExtension) (Node & Rule.NodeParentExtension) | null)
| null)
); );
return path; return path;
+1 -1
View File
@@ -77,7 +77,7 @@
"open": "^11.0.0", "open": "^11.0.0",
"p-limit": "^7.2.0", "p-limit": "^7.2.0",
"pkg-pr-new": "^0.0.54", "pkg-pr-new": "^0.0.54",
"prettier": "^3.8.1", "prettier": "^3.9.5",
"publint": "^0.3.17", "publint": "^0.3.17",
"rollup": "^4.18.0", "rollup": "^4.18.0",
"rollup-plugin-dts": "patch:rollup-plugin-dts@npm%3A6.1.0#~/.yarn/patches/rollup-plugin-dts-npm-6.1.0-6d41e665a7.patch", "rollup-plugin-dts": "patch:rollup-plugin-dts@npm%3A6.1.0#~/.yarn/patches/rollup-plugin-dts-npm-6.1.0-6d41e665a7.patch",
+1 -6
View File
@@ -371,12 +371,7 @@ function makeSimpleConfigurator(
// Types are limited here so that in the future these values can be used // Types are limited here so that in the future these values can be used
// as part of Babel's caching logic. // as part of Babel's caching logic.
export type SimpleType = export type SimpleType =
| string string | boolean | number | null | undefined | Promise<SimpleType>;
| boolean
| number
| null
| undefined
| Promise<SimpleType>;
export function assertSimpleType(value: unknown): SimpleType { export function assertSimpleType(value: unknown): SimpleType {
if (isThenable(value)) { if (isThenable(value)) {
throw new Error( throw new Error(
@@ -316,9 +316,7 @@ export type RootInputSourceMapOption = InputSourceMap | boolean;
export type RootMode = "root" | "upward" | "upward-optional"; export type RootMode = "root" | "upward" | "upward-optional";
export type TargetsListOrObject = export type TargetsListOrObject =
| Targets Targets | InputTargets | InputTargets["browsers"];
| InputTargets
| InputTargets["browsers"];
export type OptionsSource = export type OptionsSource =
| "arguments" | "arguments"
+1 -1
View File
@@ -289,7 +289,7 @@ export default class Buffer {
} }
hasContent(): boolean { hasContent(): boolean {
return this._last !== 0 /*|| this._queuedChar !== 0*/; return this._last !== 0; /*|| this._queuedChar !== 0*/
} }
/** /**
@@ -137,9 +137,7 @@ export function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {
export function _predicate( export function _predicate(
this: Printer, this: Printer,
node: node:
| t.FunctionDeclaration t.FunctionDeclaration | t.FunctionExpression | t.ArrowFunctionExpression,
| t.FunctionExpression
| t.ArrowFunctionExpression,
noLineTerminatorAfter?: boolean, noLineTerminatorAfter?: boolean,
) { ) {
if (node.predicate) { if (node.predicate) {
@@ -163,7 +161,7 @@ export function _functionHead(
// We prevent inner comments from being printed here, // We prevent inner comments from being printed here,
// so that they are always consistently printed in the // so that they are always consistently printed in the
// same place regardless of the function type. // same place regardless of the function type.
this._innerCommentsState = 0 /* INNER_COMMENT_STATE.DISALLOWED */; this._innerCommentsState = 0; /* INNER_COMMENT_STATE.DISALLOWED */
} }
this.space(); this.space();
} }
@@ -173,7 +171,7 @@ export function _functionHead(
// We prevent inner comments from being printed here, // We prevent inner comments from being printed here,
// so that they are always consistently printed in the // so that they are always consistently printed in the
// same place regardless of the function type. // same place regardless of the function type.
this._innerCommentsState = 0 /* INNER_COMMENT_STATE.DISALLOWED */; this._innerCommentsState = 0; /* INNER_COMMENT_STATE.DISALLOWED */
} }
this.token("*"); this.token("*");
} }
@@ -290,12 +288,8 @@ function _getFuncIdName(
> | null, > | null,
) { ) {
let id: let id:
| t.Expression t.Expression | t.PrivateName | t.LVal | t.VoidPattern | undefined | null =
| t.PrivateName idNode;
| t.LVal
| t.VoidPattern
| undefined
| null = idNode;
if (!id && parent) { if (!id && parent) {
const parentType = parent.type; const parentType = parent.type;
@@ -52,8 +52,7 @@ export function isUnreleasedVersion(
export function getLowestUnreleased(a: string, b: string, env: Target): string { export function getLowestUnreleased(a: string, b: string, env: Target): string {
const unreleasedLabel: const unreleasedLabel:
| (typeof unreleasedLabels)[keyof typeof unreleasedLabels] (typeof unreleasedLabels)[keyof typeof unreleasedLabels] | undefined =
| undefined =
// @ts-expect-error unreleasedLabel is undefined when env is not safari // @ts-expect-error unreleasedLabel is undefined when env is not safari
unreleasedLabels[env]; unreleasedLabels[env];
if (a === unreleasedLabel) { if (a === unreleasedLabel) {
@@ -34,9 +34,7 @@ type ClassElement =
| t.StaticBlock; | t.StaticBlock;
type ClassElementCanHaveComputedKeys = type ClassElementCanHaveComputedKeys =
| t.ClassMethod t.ClassMethod | t.ClassProperty | t.ClassAccessorProperty;
| t.ClassProperty
| t.ClassAccessorProperty;
export type DecoratorVersionKind = "2023-11"; export type DecoratorVersionKind = "2023-11";
@@ -615,8 +613,7 @@ interface DecoratorInfo {
name: t.StringLiteral | t.Expression; name: t.StringLiteral | t.Expression;
privateMethods: privateMethods:
| (t.FunctionExpression | t.ArrowFunctionExpression)[] (t.FunctionExpression | t.ArrowFunctionExpression)[] | undefined;
| undefined;
// The names of local variables that will be used/returned from the decoration // The names of local variables that will be used/returned from the decoration
locals: t.Identifier | t.Identifier[] | undefined; locals: t.Identifier | t.Identifier[] | undefined;
@@ -1365,8 +1362,7 @@ function transformClass(
let locals: t.Identifier[]; let locals: t.Identifier[];
if (hasDecorators) { if (hasDecorators) {
let privateMethods: ( let privateMethods: (
| t.FunctionExpression t.FunctionExpression | t.ArrowFunctionExpression
| t.ArrowFunctionExpression
)[]; )[];
let nameExpr: t.Expression; let nameExpr: t.Expression;
@@ -1654,9 +1650,7 @@ function transformClass(
if (classDecorators) { if (classDecorators) {
classLocals.push(classIdLocal, classInitLocal!); classLocals.push(classIdLocal, classInitLocal!);
const statics: ( const statics: (
| t.ClassProperty t.ClassProperty | t.ClassPrivateProperty | t.ClassPrivateMethod
| t.ClassPrivateProperty
| t.ClassPrivateMethod
)[] = []; )[] = [];
path.get("body.body").forEach(element => { path.get("body.body").forEach(element => {
if ( if (
@@ -1862,8 +1856,7 @@ function transformClass(
if (computedKeyAssignments.length > 0) { if (computedKeyAssignments.length > 0) {
const elements = originalClassPath.get("body.body"); const elements = originalClassPath.get("body.body");
let firstPublicElement: let firstPublicElement:
| NodePath<t.ClassProperty | t.ClassMethod> NodePath<t.ClassProperty | t.ClassMethod> | undefined;
| undefined;
for (const path of elements) { for (const path of elements) {
if ( if (
(path.isClassProperty() || path.isClassMethod()) && (path.isClassProperty() || path.isClassMethod()) &&
@@ -36,8 +36,7 @@ function isInType(path: NodePath) {
return ( return (
( (
path.parentPath.parent as path.parentPath.parent as
| t.ExportDefaultDeclaration t.ExportDefaultDeclaration | t.ExportNamedDeclaration
| t.ExportNamedDeclaration
).exportKind === "type" ).exportKind === "type"
); );
default: default:
@@ -361,9 +361,7 @@ export default function /* @no-mangle */ _regenerator() {
_arg > finallyLoc) _arg > finallyLoc)
) { ) {
entry[4] = _type as entry[4] = _type as
| OperatorType.Return OperatorType.Return | OperatorType.Jump | OperatorType.Throw;
| OperatorType.Jump
| OperatorType.Throw;
entry[5] = _arg; entry[5] = _arg;
ctx.n = finallyLoc; ctx.n = finallyLoc;
method = OperatorType.Next; method = OperatorType.Next;
+1 -2
View File
@@ -9,8 +9,7 @@ type SyntaxPlugin =
| "placeholders"; | "placeholders";
type ParseErrorCode = type ParseErrorCode =
| "BABEL_PARSER_SYNTAX_ERROR" "BABEL_PARSER_SYNTAX_ERROR" | "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
| "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED";
// Babel uses "normal" SyntaxErrors for it's errors, but adds some extra // Babel uses "normal" SyntaxErrors for it's errors, but adds some extra
// functionality. This functionality is defined in the // functionality. This functionality is defined in the
+3 -10
View File
@@ -118,10 +118,7 @@ export default abstract class ExpressionParser extends LValParser {
} }
const key = prop.key as const key = prop.key as
| N.Identifier N.Identifier | N.StringLiteral | N.NumericLiteral | N.BigIntLiteral;
| N.StringLiteral
| N.NumericLiteral
| N.BigIntLiteral;
// It is either an Identifier or a String/NumericLiteral // It is either an Identifier or a String/NumericLiteral
const name = key.type === "Identifier" ? key.name : key.value; const name = key.type === "Identifier" ? key.name : key.value;
@@ -917,12 +914,8 @@ export default abstract class ExpressionParser extends LValParser {
); );
} }
let finishedNode: let finishedNode:
| N.CallExpression N.CallExpression | N.OptionalCallExpression | N.ArrowFunctionExpression =
| N.OptionalCallExpression this.finishCallExpression(node, optionalChainMember);
| N.ArrowFunctionExpression = this.finishCallExpression(
node,
optionalChainMember,
);
if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
/*:: invariant(refExpressionErrors != null) */ /*:: invariant(refExpressionErrors != null) */
+2 -10
View File
@@ -492,11 +492,7 @@ export default abstract class LValParser extends NodeUtils {
const allowEmpty = flags & ParseBindingListFlags.ALLOW_EMPTY; const allowEmpty = flags & ParseBindingListFlags.ALLOW_EMPTY;
const elts: ( const elts: (
| Pattern Pattern | Identifier | RestElement | TSParameterProperty | null
| Identifier
| RestElement
| TSParameterProperty
| null
)[] = []; )[] = [];
let first = true; let first = true;
while (!this.eat(close)) { while (!this.eat(close)) {
@@ -736,11 +732,7 @@ export default abstract class LValParser extends NodeUtils {
checkLVal( checkLVal(
expression: expression:
| Expression Expression | ObjectMember | RestElement | Pattern | TSParameterProperty,
| ObjectMember
| RestElement
| Pattern
| TSParameterProperty,
ancestor: LValAncestor, ancestor: LValAncestor,
binding: BindingFlag = BindingFlag.TYPE_NONE, binding: BindingFlag = BindingFlag.TYPE_NONE,
checkClashes: Set<string> | false = false, checkClashes: Set<string> | false = false,
@@ -2890,9 +2890,7 @@ export default abstract class StatementParser extends ExpressionParser {
parseImportSpecifierLocal< parseImportSpecifierLocal<
T extends T extends
| N.ImportSpecifier N.ImportSpecifier | N.ImportDefaultSpecifier | N.ImportNamespaceSpecifier,
| N.ImportDefaultSpecifier
| N.ImportNamespaceSpecifier,
>( >(
node: Undone<N.ImportDeclaration>, node: Undone<N.ImportDeclaration>,
specifier: Undone<T>, specifier: Undone<T>,
@@ -2904,9 +2902,7 @@ export default abstract class StatementParser extends ExpressionParser {
finishImportSpecifier< finishImportSpecifier<
T extends T extends
| N.ImportSpecifier N.ImportSpecifier | N.ImportDefaultSpecifier | N.ImportNamespaceSpecifier,
| N.ImportDefaultSpecifier
| N.ImportNamespaceSpecifier,
>( >(
specifier: Undone<T>, specifier: Undone<T>,
type: T["type"], type: T["type"],
+1 -6
View File
@@ -158,10 +158,5 @@ export const mixinPlugins = {
}; };
export const mixinPluginNames = Object.keys(mixinPlugins) as readonly ( export const mixinPluginNames = Object.keys(mixinPlugins) as readonly (
| "estree" "estree" | "jsx" | "flow" | "typescript" | "v8intrinsic" | "placeholders"
| "jsx"
| "flow"
| "typescript"
| "v8intrinsic"
| "placeholders"
)[]; )[];
@@ -595,10 +595,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
!insideModule) !insideModule)
) { ) {
const label = this.state.value as const label = this.state.value as
| "const" "const" | "let" | "type" | "interface";
| "let"
| "type"
| "interface";
throw this.raise( throw this.raise(
FlowErrors.UnsupportedDeclareExportKind, FlowErrors.UnsupportedDeclareExportKind,
this.state.startLoc, this.state.startLoc,
@@ -958,8 +955,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
// Used when parsing type arguments from ES or JSX productions, where the first token // Used when parsing type arguments from ES or JSX productions, where the first token
// has been created without state.inType. Thus we need to re-scan the lt token. // has been created without state.inType. Thus we need to re-scan the lt token.
flowParseTypeParameterInstantiationInExpression(): flowParseTypeParameterInstantiationInExpression():
| N.TypeParameterInstantiation N.TypeParameterInstantiation | undefined {
| undefined {
if (this.reScan_lt() !== tt.lt) return; if (this.reScan_lt() !== tt.lt) return;
return this.flowParseTypeParameterInstantiation(); return this.flowParseTypeParameterInstantiation();
} }
@@ -3111,10 +3107,8 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
}, state); }, state);
let arrowExpression: let arrowExpression:
| N.ArrowFunctionExpression N.ArrowFunctionExpression | N.TypeCastExpression | undefined | null =
| N.TypeCastExpression null;
| undefined
| null = null;
if ( if (
arrow.node && arrow.node &&
@@ -3214,8 +3208,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
setArrowFunctionParameters( setArrowFunctionParameters(
node: Undone<N.ArrowFunctionExpression>, node: Undone<N.ArrowFunctionExpression>,
params: params:
| (N.Expression | N.SpreadElement)[] (N.Expression | N.SpreadElement)[] | (N.Expression | N.RestElement)[],
| (N.Expression | N.RestElement)[],
): void { ): void {
if ( if (
this.state.noArrowParamsConversionAt.includes( this.state.noArrowParamsConversionAt.includes(
@@ -302,9 +302,7 @@ export default (superClass: typeof Parser) =>
// or single identifier. // or single identifier.
jsxParseElementName(): jsxParseElementName():
| N.JSXIdentifier N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression {
| N.JSXNamespacedName
| N.JSXMemberExpression {
const startLoc = this.state.startLoc; const startLoc = this.state.startLoc;
let node: N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression = let node: N.JSXIdentifier | N.JSXNamespacedName | N.JSXMemberExpression =
this.jsxParseNamespacedName(); this.jsxParseNamespacedName();
@@ -323,9 +321,7 @@ export default (superClass: typeof Parser) =>
// Parses any type of JSX attribute value. // Parses any type of JSX attribute value.
jsxParseAttributeValue(): jsxParseAttributeValue():
| N.JSXExpressionContainer N.JSXExpressionContainer | N.JSXElement | N.StringLiteral {
| N.JSXElement
| N.StringLiteral {
let node; let node;
switch (this.state.type) { switch (this.state.type) {
case tt.braceL: case tt.braceL:
@@ -934,12 +934,10 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
tsTryParseIndexSignature( tsTryParseIndexSignature(
node: Undone<N.TSIndexSignature>, node: Undone<N.TSIndexSignature>,
): N.TSIndexSignature | undefined { ): N.TSIndexSignature | undefined {
if ( if (!(
!(
this.match(tt.bracketL) && this.match(tt.bracketL) &&
this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)) this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))
) )) {
) {
return; return;
} }
@@ -2400,8 +2398,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
// Used when parsing type arguments from ES or JSX productions, where the first token // Used when parsing type arguments from ES or JSX productions, where the first token
// has been created without state.inType. Thus we need to re-scan the lt token. // has been created without state.inType. Thus we need to re-scan the lt token.
tsParseTypeArgumentsInExpression(): tsParseTypeArgumentsInExpression():
| N.TSTypeParameterInstantiation N.TSTypeParameterInstantiation | undefined {
| undefined {
if (this.reScan_lt() !== tt.lt) return; if (this.reScan_lt() !== tt.lt) return;
return this.tsParseTypeArguments(); return this.tsParseTypeArguments();
} }
@@ -4258,10 +4255,7 @@ export default (superClass: ClassWithMixin<typeof Parser, IJSXParserMixin>) =>
toAssignableListItem( toAssignableListItem(
exprList: ( exprList: (
| N.Expression N.Expression | N.SpreadElement | N.RestElement | N.TSTypeCastExpression
| N.SpreadElement
| N.RestElement
| N.TSTypeCastExpression
)[], )[],
index: number, index: number,
isLHS: boolean, isLHS: boolean,
+1 -2
View File
@@ -7,8 +7,7 @@ import { tt, type TokenType } from "./types.ts";
import type { Errors, ParseError } from "../parse-error.ts"; import type { Errors, ParseError } from "../parse-error.ts";
export type DeferredStrictError = export type DeferredStrictError =
| typeof Errors.StrictNumericEscape typeof Errors.StrictNumericEscape | typeof Errors.StrictOctalLiteral;
| typeof Errors.StrictOctalLiteral;
export const enum LoopLabelKind { export const enum LoopLabelKind {
Loop = 1, Loop = 1,
+3 -10
View File
@@ -186,9 +186,7 @@ export type ESTreeClassElement =
export type ESTreeLiteral = EstreeLiteral | EstreeBigIntLiteral; export type ESTreeLiteral = EstreeLiteral | EstreeBigIntLiteral;
export type ESTreeExpression = export type ESTreeExpression =
| EstreeChainExpression EstreeChainExpression | ESTreeLiteral | EstreeTSEmptyBodyFunctionExpression;
| ESTreeLiteral
| EstreeTSEmptyBodyFunctionExpression;
export type Node = N.Node | ESTreeNode | TSTypeCastExpression; export type Node = N.Node | ESTreeNode | TSTypeCastExpression;
@@ -198,9 +196,7 @@ export type NormalFunction = N.FunctionDeclaration | N.FunctionExpression;
export type Assignable = N.AssignmentExpression["left"]; export type Assignable = N.AssignmentExpression["left"];
export type ObjectOrClassMember = export type ObjectOrClassMember =
| N.ClassMethod N.ClassMethod | N.ClassProperty | N.ObjectMember;
| N.ClassProperty
| N.ObjectMember;
export type ObjectMember = N.ObjectProperty | N.ObjectMethod; export type ObjectMember = N.ObjectProperty | N.ObjectMethod;
@@ -212,10 +208,7 @@ export type ClassMember =
| N.ClassAccessorProperty; | N.ClassAccessorProperty;
export type MethodLike = export type MethodLike =
| N.ObjectMethod N.ObjectMethod | N.ClassMethod | N.ClassPrivateMethod | N.TSDeclareMethod;
| N.ClassMethod
| N.ClassPrivateMethod
| N.TSDeclareMethod;
export type AnyImport = N.ImportDeclaration | N.TSImportEqualsDeclaration; export type AnyImport = N.ImportDeclaration | N.TSImportEqualsDeclaration;
export type AnyExport = export type AnyExport =
@@ -73,8 +73,7 @@ class ExpressionScope {
} }
type ArrowHeadParsingParameterInitializerError = type ArrowHeadParsingParameterInitializerError =
| typeof Errors.AwaitExpressionFormalParameter typeof Errors.AwaitExpressionFormalParameter | typeof Errors.YieldInParameter;
| typeof Errors.YieldInParameter;
type ArrowHeadParsingDeclarationError = type ArrowHeadParsingDeclarationError =
| ArrowHeadParsingParameterInitializerError | ArrowHeadParsingParameterInitializerError
| typeof Errors.InvalidParenthesizedAssignment | typeof Errors.InvalidParenthesizedAssignment
@@ -271,11 +271,7 @@ export function* traversePattern(
export function hasPrivateKeys( export function hasPrivateKeys(
pattern: pattern:
| t.LVal t.LVal | t.PatternLike | t.OptionalMemberExpression | null | undefined,
| t.PatternLike
| t.OptionalMemberExpression
| null
| undefined,
) { ) {
let result = false; let result = false;
traversePattern(pattern, function* (node) { traversePattern(pattern, function* (node) {
@@ -147,9 +147,7 @@ export function removeTrailingVoidPatternsFromParams(
export function isAnonymousFunctionDefinition( export function isAnonymousFunctionDefinition(
node: t.Node | null, node: t.Node | null,
): node is ): node is
| t.ClassExpression t.ClassExpression | t.ArrowFunctionExpression | t.FunctionExpression {
| t.ArrowFunctionExpression
| t.FunctionExpression {
return ( return (
t.isArrowFunctionExpression(node) || t.isArrowFunctionExpression(node) ||
((t.isFunctionExpression(node) || t.isClassExpression(node)) && !node.id) ((t.isFunctionExpression(node) || t.isClassExpression(node)) && !node.id)
@@ -144,9 +144,8 @@ export default declare(({ types: t, template, traverse, assertVersion }) => {
const pendingStaticBlocks: t.StaticBlock[] = []; const pendingStaticBlocks: t.StaticBlock[] = [];
let lastStaticProp: let lastStaticProp:
| null null | NodePath<t.ClassProperty> | NodePath<t.ClassPrivateProperty> =
| NodePath<t.ClassProperty> null;
| NodePath<t.ClassPrivateProperty> = null;
for (const path of classBody.get("body")) { for (const path of classBody.get("body")) {
if (path.isStaticBlock()) { if (path.isStaticBlock()) {
@@ -284,8 +284,7 @@ export default function transformClass(
]; ];
if (bareSuperNode.arguments?.length) { if (bareSuperNode.arguments?.length) {
const bareSuperNodeArguments = bareSuperNode.arguments as ( const bareSuperNodeArguments = bareSuperNode.arguments as (
| t.Expression t.Expression | t.SpreadElement
| t.SpreadElement
)[]; )[];
/** /**
@@ -79,9 +79,7 @@ const arrayUnpackVisitor = (
}; };
export type DestructuringTransformerNode = export type DestructuringTransformerNode =
| t.VariableDeclaration t.VariableDeclaration | t.ExpressionStatement | t.ReturnStatement;
| t.ExpressionStatement
| t.ReturnStatement;
// using/await using declaration must not contain pattern as its id. // using/await using declaration must not contain pattern as its id.
export type VariableDeclarationKindAllowsPattern = Exclude< export type VariableDeclarationKindAllowsPattern = Exclude<
@@ -12,9 +12,7 @@ const enum USING_KIND {
function isAnonymousFunctionDefinition( function isAnonymousFunctionDefinition(
node: t.Node, node: t.Node,
): node is ): node is
| t.ClassExpression t.ClassExpression | t.ArrowFunctionExpression | t.FunctionExpression {
| t.ArrowFunctionExpression
| t.FunctionExpression {
return ( return (
t.isArrowFunctionExpression(node) || t.isArrowFunctionExpression(node) ||
((t.isFunctionExpression(node) || t.isClassExpression(node)) && !node.id) ((t.isFunctionExpression(node) || t.isClassExpression(node)) && !node.id)
@@ -121,8 +121,7 @@ export function transformOptionalChain(
for (let i = optionals.length - 1; i >= 0; i--) { for (let i = optionals.length - 1; i >= 0; i--) {
const node = optionals[i] as unknown as const node = optionals[i] as unknown as
| t.MemberExpression t.MemberExpression | t.CallExpression;
| t.CallExpression;
const isCall = t.isCallExpression(node); const isCall = t.isCallExpression(node);
@@ -136,7 +136,6 @@ const memberExpressionOptimisationVisitor: Visitor<State> = {
!state.deopted && !state.deopted &&
!( !(
// ex: `args[0] = "whatever"` // ex: `args[0] = "whatever"`
(
(grandparentPath.isAssignmentExpression() && (grandparentPath.isAssignmentExpression() &&
parentPath.node === grandparentPath.node.left) || // ex: `[args[0]] = ["whatever"]` parentPath.node === grandparentPath.node.left) || // ex: `[args[0]] = ["whatever"]`
grandparentPath.isLVal() || // ex: `for (rest[0] in this)` grandparentPath.isLVal() || // ex: `for (rest[0] in this)`
@@ -150,7 +149,6 @@ const memberExpressionOptimisationVisitor: Visitor<State> = {
((grandparentPath.isCallExpression() || ((grandparentPath.isCallExpression() ||
grandparentPath.isNewExpression()) && grandparentPath.isNewExpression()) &&
parentPath.node === grandparentPath.node.callee) parentPath.node === grandparentPath.node.callee)
)
); );
if (argsOptEligible) { if (argsOptEligible) {
if (parentPath.node.computed) { if (parentPath.node.computed) {
@@ -135,8 +135,7 @@ export default declare((api, opt: Options) => {
const { name } = node.left.id; const { name } = node.left.id;
let privateElement: let privateElement:
| NodePath<t.ClassPrivateMethod | t.ClassPrivateProperty> NodePath<t.ClassPrivateMethod | t.ClassPrivateProperty> | undefined;
| undefined;
const outerClass = path.findParent(path => { const outerClass = path.findParent(path => {
if (!path.isClass()) return false; if (!path.isClass()) return false;
@@ -1307,8 +1307,7 @@ export class Emitter {
t.updateExpression( t.updateExpression(
path.node.operator, path.node.operator,
self.explodeExpression(path.get("argument")) as self.explodeExpression(path.get("argument")) as
| t.Identifier t.Identifier | t.MemberExpression,
| t.MemberExpression,
path.node.prefix, path.node.prefix,
), ),
); );
@@ -474,8 +474,7 @@ function standardizeSuperProperty(
const assignmentPath = superProp.parentPath; const assignmentPath = superProp.parentPath;
const op = assignmentPath.node.operator.slice(0, -1) as const op = assignmentPath.node.operator.slice(0, -1) as
| LogicalOp LogicalOp | BinaryOp;
| BinaryOp;
const value = assignmentPath.node.right; const value = assignmentPath.node.right;
+1 -5
View File
@@ -377,11 +377,7 @@ interface NodePathOverwrites {
this: NodePath_Final, this: NodePath_Final,
): asserts this is NodePath_Final< ): asserts this is NodePath_Final<
( (
| t.Loop t.Loop | t.WithStatement | t.Function | t.LabeledStatement | t.CatchClause
| t.WithStatement
| t.Function
| t.LabeledStatement
| t.CatchClause
) & { body: t.BlockStatement } ) & { body: t.BlockStatement }
>; >;
/** /**
@@ -3,9 +3,7 @@ import type * as t from "@babel/types";
export interface VirtualTypeAliases { export interface VirtualTypeAliases {
BindingIdentifier: t.Identifier; BindingIdentifier: t.Identifier;
BlockScoped: BlockScoped:
| t.FunctionDeclaration t.FunctionDeclaration | t.ClassDeclaration | t.VariableDeclaration;
| t.ClassDeclaration
| t.VariableDeclaration;
ExistentialTypeParam: t.ExistsTypeAnnotation; ExistentialTypeParam: t.ExistsTypeAnnotation;
Expression: t.Expression; Expression: t.Expression;
Flow: t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier; Flow: t.Flow | t.ImportDeclaration | t.ExportDeclaration | t.ImportSpecifier;
+1 -2
View File
@@ -1244,8 +1244,7 @@ class Scope {
hasBinding( hasBinding(
name: string, name: string,
opts?: opts?:
| boolean boolean | { noGlobals?: boolean; noUids?: boolean; upToScope?: Scope },
| { noGlobals?: boolean; noUids?: boolean; upToScope?: Scope },
) { ) {
if (!name) return false; if (!name) return false;
// TODO: Only accept the object form. // TODO: Only accept the object form.
+1 -2
View File
@@ -64,8 +64,7 @@ export interface VisitorBase<S>
export type Visitor<S = unknown> = VisitorBase<S> | ExplodedVisitor<S>; export type Visitor<S = unknown> = VisitorBase<S> | ExplodedVisitor<S>;
export type VisitNode<S, P extends t.Node> = export type VisitNode<S, P extends t.Node> =
| VisitNodeFunction<S, P> VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
| VisitNodeObject<S, P>;
export type VisitNodeFunction<S, P extends t.Node> = ( export type VisitNodeFunction<S, P extends t.Node> = (
this: S, this: S,
@@ -405,9 +405,7 @@ export interface CallExpression extends BaseNode {
callee: Expression | Super | Import | V8IntrinsicIdentifier; callee: Expression | Super | Import | V8IntrinsicIdentifier;
arguments: (Expression | SpreadElement | ArgumentPlaceholder)[]; arguments: (Expression | SpreadElement | ArgumentPlaceholder)[];
typeArguments?: typeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
} }
export interface CatchClause extends BaseNode { export interface CatchClause extends BaseNode {
@@ -586,17 +584,14 @@ export interface MemberExpressionNonComputed extends BaseNode {
property: Identifier | PrivateName; property: Identifier | PrivateName;
} }
export type MemberExpression = export type MemberExpression =
| MemberExpressionComputed MemberExpressionComputed | MemberExpressionNonComputed;
| MemberExpressionNonComputed;
export interface NewExpression extends BaseNode { export interface NewExpression extends BaseNode {
type: "NewExpression"; type: "NewExpression";
callee: Expression; callee: Expression;
arguments: (Expression | SpreadElement | ArgumentPlaceholder)[]; arguments: (Expression | SpreadElement | ArgumentPlaceholder)[];
typeArguments?: typeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
} }
export interface Program extends BaseNode { export interface Program extends BaseNode {
@@ -655,11 +650,7 @@ export interface ObjectPropertyNonComputed extends BaseNode {
decorators?: Decorator[] | null; decorators?: Decorator[] | null;
computed: false; computed: false;
key: key:
| Identifier Identifier | StringLiteral | NumericLiteral | BigIntLiteral | PrivateName;
| StringLiteral
| NumericLiteral
| BigIntLiteral
| PrivateName;
} }
export type ObjectProperty = ObjectPropertyComputed | ObjectPropertyNonComputed; export type ObjectProperty = ObjectPropertyComputed | ObjectPropertyNonComputed;
@@ -841,9 +832,7 @@ export interface ClassExpression extends BaseNode {
implements?: (TSClassImplements | ClassImplements)[] | null; implements?: (TSClassImplements | ClassImplements)[] | null;
mixins?: InterfaceExtends | null; mixins?: InterfaceExtends | null;
superTypeArguments?: superTypeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | null;
} }
@@ -858,9 +847,7 @@ export interface ClassDeclaration extends BaseNode {
implements?: (TSClassImplements | ClassImplements)[] | null; implements?: (TSClassImplements | ClassImplements)[] | null;
mixins?: InterfaceExtends | null; mixins?: InterfaceExtends | null;
superTypeArguments?: superTypeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | null; typeParameters?: TypeParameterDeclaration | TSTypeParameterDeclaration | null;
} }
@@ -901,9 +888,7 @@ export interface ExportNamedDeclaration extends BaseNode {
| TypeAlias | TypeAlias
| null; | null;
specifiers: ( specifiers: (
| ExportSpecifier ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier
| ExportDefaultSpecifier
| ExportNamespaceSpecifier
)[]; )[];
source?: StringLiteral | null; source?: StringLiteral | null;
attributes?: ImportAttribute[] | null; attributes?: ImportAttribute[] | null;
@@ -937,9 +922,7 @@ export interface ForOfStatement extends BaseNode {
export interface ImportDeclaration extends BaseNode { export interface ImportDeclaration extends BaseNode {
type: "ImportDeclaration"; type: "ImportDeclaration";
specifiers: ( specifiers: (
| ImportSpecifier ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier
| ImportDefaultSpecifier
| ImportNamespaceSpecifier
)[]; )[];
source: StringLiteral; source: StringLiteral;
attributes?: ImportAttribute[] | null; attributes?: ImportAttribute[] | null;
@@ -1041,9 +1024,7 @@ export interface TaggedTemplateExpression extends BaseNode {
tag: Expression; tag: Expression;
quasi: TemplateLiteral; quasi: TemplateLiteral;
typeArguments?: typeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
} }
export interface TemplateElement extends BaseNode { export interface TemplateElement extends BaseNode {
@@ -1105,8 +1086,7 @@ export interface OptionalMemberExpressionNonComputed extends BaseNode {
property: Identifier | PrivateName; property: Identifier | PrivateName;
} }
export type OptionalMemberExpression = export type OptionalMemberExpression =
| OptionalMemberExpressionComputed OptionalMemberExpressionComputed | OptionalMemberExpressionNonComputed;
| OptionalMemberExpressionNonComputed;
export interface OptionalCallExpression extends BaseNode { export interface OptionalCallExpression extends BaseNode {
type: "OptionalCallExpression"; type: "OptionalCallExpression";
@@ -1114,9 +1094,7 @@ export interface OptionalCallExpression extends BaseNode {
arguments: (Expression | SpreadElement | ArgumentPlaceholder)[]; arguments: (Expression | SpreadElement | ArgumentPlaceholder)[];
optional: boolean; optional: boolean;
typeArguments?: typeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
} }
export interface ClassPropertyComputed extends BaseNode { export interface ClassPropertyComputed extends BaseNode {
@@ -1606,11 +1584,7 @@ export interface JSXAttribute extends BaseNode {
type: "JSXAttribute"; type: "JSXAttribute";
name: JSXIdentifier | JSXNamespacedName; name: JSXIdentifier | JSXNamespacedName;
value?: value?:
| JSXElement JSXElement | JSXFragment | StringLiteral | JSXExpressionContainer | null;
| JSXFragment
| StringLiteral
| JSXExpressionContainer
| null;
} }
export interface JSXClosingElement extends BaseNode { export interface JSXClosingElement extends BaseNode {
@@ -1623,11 +1597,7 @@ export interface JSXElement extends BaseNode {
openingElement: JSXOpeningElement; openingElement: JSXOpeningElement;
closingElement?: JSXClosingElement | null; closingElement?: JSXClosingElement | null;
children: ( children: (
| JSXText JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment
| JSXExpressionContainer
| JSXSpreadChild
| JSXElement
| JSXFragment
)[]; )[];
} }
@@ -1668,9 +1638,7 @@ export interface JSXOpeningElement extends BaseNode {
attributes: (JSXAttribute | JSXSpreadAttribute)[]; attributes: (JSXAttribute | JSXSpreadAttribute)[];
selfClosing: boolean; selfClosing: boolean;
typeArguments?: typeArguments?:
| TypeParameterInstantiation TypeParameterInstantiation | TSTypeParameterInstantiation | null;
| TSTypeParameterInstantiation
| null;
} }
export interface JSXSpreadAttribute extends BaseNode { export interface JSXSpreadAttribute extends BaseNode {
@@ -1688,11 +1656,7 @@ export interface JSXFragment extends BaseNode {
openingFragment: JSXOpeningFragment; openingFragment: JSXOpeningFragment;
closingFragment: JSXClosingFragment; closingFragment: JSXClosingFragment;
children: ( children: (
| JSXText JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment
| JSXExpressionContainer
| JSXSpreadChild
| JSXElement
| JSXFragment
)[]; )[];
} }
@@ -1769,15 +1733,10 @@ export interface ClassAccessorPropertyNonComputed extends BaseNode {
variance?: Variance | null; variance?: Variance | null;
computed: false; computed: false;
key: key:
| Identifier Identifier | StringLiteral | NumericLiteral | BigIntLiteral | PrivateName;
| StringLiteral
| NumericLiteral
| BigIntLiteral
| PrivateName;
} }
export type ClassAccessorProperty = export type ClassAccessorProperty =
| ClassAccessorPropertyComputed ClassAccessorPropertyComputed | ClassAccessorPropertyNonComputed;
| ClassAccessorPropertyNonComputed;
export interface Decorator extends BaseNode { export interface Decorator extends BaseNode {
type: "Decorator"; type: "Decorator";
@@ -1863,8 +1822,7 @@ export interface TSDeclareMethodNonComputed extends BaseNode {
key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
} }
export type TSDeclareMethod = export type TSDeclareMethod =
| TSDeclareMethodComputed TSDeclareMethodComputed | TSDeclareMethodNonComputed;
| TSDeclareMethodNonComputed;
export interface TSQualifiedName extends BaseNode { export interface TSQualifiedName extends BaseNode {
type: "TSQualifiedName"; type: "TSQualifiedName";
@@ -2484,10 +2442,7 @@ export type Terminatorless =
| YieldExpression | YieldExpression
| AwaitExpression; | AwaitExpression;
export type CompletionStatement = export type CompletionStatement =
| BreakStatement BreakStatement | ContinueStatement | ReturnStatement | ThrowStatement;
| ContinueStatement
| ReturnStatement
| ThrowStatement;
export type Conditional = ConditionalExpression | IfStatement; export type Conditional = ConditionalExpression | IfStatement;
export type Loop = export type Loop =
| DoWhileStatement | DoWhileStatement
@@ -2497,9 +2452,7 @@ export type Loop =
| ForOfStatement; | ForOfStatement;
export type While = DoWhileStatement | WhileStatement; export type While = DoWhileStatement | WhileStatement;
export type ExpressionWrapper = export type ExpressionWrapper =
| ExpressionStatement ExpressionStatement | ParenthesizedExpression | TypeCastExpression;
| ParenthesizedExpression
| TypeCastExpression;
export type For = ForInStatement | ForStatement | ForOfStatement; export type For = ForInStatement | ForStatement | ForOfStatement;
export type ForXStatement = ForInStatement | ForOfStatement; export type ForXStatement = ForInStatement | ForOfStatement;
export type Function = export type Function =
@@ -2620,16 +2573,10 @@ export type UserWhitespacable =
export type Method = ObjectMethod | ClassMethod | ClassPrivateMethod; export type Method = ObjectMethod | ClassMethod | ClassPrivateMethod;
export type ObjectMember = ObjectMethod | ObjectProperty; export type ObjectMember = ObjectMethod | ObjectProperty;
export type Property = export type Property =
| ObjectProperty ObjectProperty | ClassProperty | ClassPrivateProperty | ClassAccessorProperty;
| ClassProperty
| ClassPrivateProperty
| ClassAccessorProperty;
export type UnaryLike = UnaryExpression | SpreadElement; export type UnaryLike = UnaryExpression | SpreadElement;
export type Pattern = export type Pattern =
| AssignmentPattern AssignmentPattern | ArrayPattern | ObjectPattern | VoidPattern;
| ArrayPattern
| ObjectPattern
| VoidPattern;
export type Class = ClassExpression | ClassDeclaration; export type Class = ClassExpression | ClassDeclaration;
export type ImportOrExportDeclaration = export type ImportOrExportDeclaration =
| ExportAllDeclaration | ExportAllDeclaration
@@ -2637,9 +2584,7 @@ export type ImportOrExportDeclaration =
| ExportNamedDeclaration | ExportNamedDeclaration
| ImportDeclaration; | ImportDeclaration;
export type ExportDeclaration = export type ExportDeclaration =
| ExportAllDeclaration ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration;
| ExportDefaultDeclaration
| ExportNamedDeclaration;
export type ModuleSpecifier = export type ModuleSpecifier =
| ExportSpecifier | ExportSpecifier
| ImportDefaultSpecifier | ImportDefaultSpecifier
@@ -2770,15 +2715,9 @@ export type FlowDeclaration =
| TypeAlias; | TypeAlias;
export type FlowPredicate = DeclaredPredicate | InferredPredicate; export type FlowPredicate = DeclaredPredicate | InferredPredicate;
export type EnumBody = export type EnumBody =
| EnumBooleanBody EnumBooleanBody | EnumNumberBody | EnumStringBody | EnumSymbolBody;
| EnumNumberBody
| EnumStringBody
| EnumSymbolBody;
export type EnumMember = export type EnumMember =
| EnumBooleanMember EnumBooleanMember | EnumNumberMember | EnumStringMember | EnumDefaultedMember;
| EnumNumberMember
| EnumStringMember
| EnumDefaultedMember;
export type JSX = export type JSX =
| JSXAttribute | JSXAttribute
| JSXClosingElement | JSXClosingElement
@@ -2988,10 +2927,7 @@ export interface Aliases {
} }
export type DeprecatedAliases = export type DeprecatedAliases =
| NumberLiteral NumberLiteral | RegexLiteral | RestProperty | SpreadProperty;
| RegexLiteral
| RestProperty
| SpreadProperty;
export interface ParentMaps { export interface ParentMaps {
AnyTypeAnnotation: AnyTypeAnnotation:
@@ -4252,9 +4188,7 @@ export interface ParentMaps {
| WhileStatement | WhileStatement
| WithStatement; | WithStatement;
EnumDefaultedMember: EnumDefaultedMember:
| DeclareExportDeclaration DeclareExportDeclaration | EnumStringBody | EnumSymbolBody;
| EnumStringBody
| EnumSymbolBody;
EnumNumberBody: DeclareExportDeclaration | EnumDeclaration; EnumNumberBody: DeclareExportDeclaration | EnumDeclaration;
EnumNumberMember: DeclareExportDeclaration | EnumNumberBody; EnumNumberMember: DeclareExportDeclaration | EnumNumberBody;
EnumStringBody: DeclareExportDeclaration | EnumDeclaration; EnumStringBody: DeclareExportDeclaration | EnumDeclaration;
@@ -4989,9 +4923,7 @@ export interface ParentMaps {
| JSXNamespacedName | JSXNamespacedName
| JSXOpeningElement; | JSXOpeningElement;
JSXMemberExpression: JSXMemberExpression:
| JSXClosingElement JSXClosingElement | JSXMemberExpression | JSXOpeningElement;
| JSXMemberExpression
| JSXOpeningElement;
JSXNamespacedName: JSXAttribute | JSXClosingElement | JSXOpeningElement; JSXNamespacedName: JSXAttribute | JSXClosingElement | JSXOpeningElement;
JSXOpeningElement: JSXElement; JSXOpeningElement: JSXElement;
JSXOpeningFragment: JSXFragment; JSXOpeningFragment: JSXFragment;
@@ -258,11 +258,7 @@ export function callExpression(
} }
export function catchClause( export function catchClause(
param: param:
| t.Identifier t.Identifier | t.ArrayPattern | t.ObjectPattern | null | undefined = null,
| t.ArrayPattern
| t.ObjectPattern
| null
| undefined = null,
body: t.BlockStatement, body: t.BlockStatement,
): t.CatchClause { ): t.CatchClause {
const node: t.CatchClause = { const node: t.CatchClause = {
@@ -1107,9 +1103,7 @@ export function exportNamedDeclaration(
| t.TypeAlias | t.TypeAlias
| null = null, | null = null,
specifiers: ( specifiers: (
| t.ExportSpecifier t.ExportSpecifier | t.ExportDefaultSpecifier | t.ExportNamespaceSpecifier
| t.ExportDefaultSpecifier
| t.ExportNamespaceSpecifier
)[] = [], )[] = [],
source: t.StringLiteral | null = null, source: t.StringLiteral | null = null,
attributes: t.ImportAttribute[] | null = null, attributes: t.ImportAttribute[] | null = null,
@@ -1173,9 +1167,7 @@ export function forOfStatement(
} }
export function importDeclaration( export function importDeclaration(
specifiers: ( specifiers: (
| t.ImportSpecifier t.ImportSpecifier | t.ImportDefaultSpecifier | t.ImportNamespaceSpecifier
| t.ImportDefaultSpecifier
| t.ImportNamespaceSpecifier
)[], )[],
source: t.StringLiteral, source: t.StringLiteral,
attributes: t.ImportAttribute[] | null = null, attributes: t.ImportAttribute[] | null = null,
@@ -2321,10 +2313,7 @@ export function voidTypeAnnotation(): t.VoidTypeAnnotation {
export function enumDeclaration( export function enumDeclaration(
id: t.Identifier, id: t.Identifier,
body: body:
| t.EnumBooleanBody t.EnumBooleanBody | t.EnumNumberBody | t.EnumStringBody | t.EnumSymbolBody,
| t.EnumNumberBody
| t.EnumStringBody
| t.EnumSymbolBody,
): t.EnumDeclaration { ): t.EnumDeclaration {
const node: t.EnumDeclaration = { const node: t.EnumDeclaration = {
type: "EnumDeclaration", type: "EnumDeclaration",
@@ -7,10 +7,7 @@ import cleanJSXElementLiteralChild from "../../utils/react/cleanJSXElementLitera
import type * as t from "../../index.ts"; import type * as t from "../../index.ts";
type ReturnedChild = type ReturnedChild =
| t.JSXSpreadChild t.JSXSpreadChild | t.JSXElement | t.JSXFragment | t.Expression;
| t.JSXElement
| t.JSXFragment
| t.Expression;
export default function buildChildren( export default function buildChildren(
node: t.JSXElement | t.JSXFragment, node: t.JSXElement | t.JSXFragment,
+5 -5
View File
@@ -7662,7 +7662,7 @@ __metadata:
open: "npm:^11.0.0" open: "npm:^11.0.0"
p-limit: "npm:^7.2.0" p-limit: "npm:^7.2.0"
pkg-pr-new: "npm:^0.0.54" pkg-pr-new: "npm:^0.0.54"
prettier: "npm:^3.8.1" prettier: "npm:^3.9.5"
publint: "npm:^0.3.17" publint: "npm:^0.3.17"
rollup: "npm:^4.18.0" rollup: "npm:^4.18.0"
rollup-plugin-dts: "patch:rollup-plugin-dts@npm%3A6.1.0#~/.yarn/patches/rollup-plugin-dts-npm-6.1.0-6d41e665a7.patch" rollup-plugin-dts: "patch:rollup-plugin-dts@npm%3A6.1.0#~/.yarn/patches/rollup-plugin-dts-npm-6.1.0-6d41e665a7.patch"
@@ -14684,12 +14684,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"prettier@npm:^3.8.1": "prettier@npm:^3.9.5":
version: 3.8.3 version: 3.9.5
resolution: "prettier@npm:3.8.3" resolution: "prettier@npm:3.9.5"
bin: bin:
prettier: bin/prettier.cjs prettier: bin/prettier.cjs
checksum: 10/4b3b12cbb29e4c96bed936e5d070167552500c18d37676fb3e0caae6199c42860662608e4dc116230698f6e2bb0267ef2548158224c92d40f188d309d72fdd6f checksum: 10/b6587f1582ba653ce5207ee227aff646500e5098646931088f176d1ab090b1f47d5a333f1facd634e9aa7dcb15c45940e2cec13a5962534cf0200617517b67b6
languageName: node languageName: node
linkType: hard linkType: hard