Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JSXNamespacedName from valid CallExpression args #16421

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ export default declare(api => {
);
node.argument = t.cloneNode(id);
} else {
init.push(
t.assignmentExpression(
"=",
t.cloneNode(id),
// @ts-expect-error Fixme: may need to handle JSXNamespacedName here
node,
),
);
init.push(t.assignmentExpression("=", t.cloneNode(id), node));
args[i] = t.cloneNode(id);
}
}
Expand Down
20 changes: 4 additions & 16 deletions packages/babel-types/src/ast-types/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,7 @@ export interface BreakStatement extends BaseNode {
export interface CallExpression extends BaseNode {
type: "CallExpression";
callee: Expression | Super | V8IntrinsicIdentifier;
arguments: Array<
Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder
>;
arguments: Array<Expression | SpreadElement | ArgumentPlaceholder>;
optional?: true | false | null;
typeArguments?: TypeParameterInstantiation | null;
typeParameters?: TSTypeParameterInstantiation | null;
Expand Down Expand Up @@ -556,9 +554,7 @@ export interface MemberExpression extends BaseNode {
export interface NewExpression extends BaseNode {
type: "NewExpression";
callee: Expression | Super | V8IntrinsicIdentifier;
arguments: Array<
Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder
>;
arguments: Array<Expression | SpreadElement | ArgumentPlaceholder>;
optional?: true | false | null;
typeArguments?: TypeParameterInstantiation | null;
typeParameters?: TSTypeParameterInstantiation | null;
Expand Down Expand Up @@ -1003,9 +999,7 @@ export interface OptionalMemberExpression extends BaseNode {
export interface OptionalCallExpression extends BaseNode {
type: "OptionalCallExpression";
callee: Expression;
arguments: Array<
Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder
>;
arguments: Array<Expression | SpreadElement | ArgumentPlaceholder>;
optional: boolean;
typeArguments?: TypeParameterInstantiation | null;
typeParameters?: TSTypeParameterInstantiation | null;
Expand Down Expand Up @@ -5039,13 +5033,7 @@ export interface ParentMaps {
| JSXClosingElement
| JSXMemberExpression
| JSXOpeningElement;
JSXNamespacedName:
| CallExpression
| JSXAttribute
| JSXClosingElement
| JSXOpeningElement
| NewExpression
| OptionalCallExpression;
JSXNamespacedName: JSXAttribute | JSXClosingElement | JSXOpeningElement;
JSXOpeningElement: JSXElement;
JSXOpeningFragment: JSXFragment;
JSXSpreadAttribute: JSXOpeningElement;
Expand Down
12 changes: 3 additions & 9 deletions packages/babel-types/src/builders/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ export function breakStatement(
}
export function callExpression(
callee: t.Expression | t.Super | t.V8IntrinsicIdentifier,
_arguments: Array<
t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
>,
_arguments: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder>,
): t.CallExpression {
return validateNode<t.CallExpression>({
type: "CallExpression",
Expand Down Expand Up @@ -330,9 +328,7 @@ export function memberExpression(
}
export function newExpression(
callee: t.Expression | t.Super | t.V8IntrinsicIdentifier,
_arguments: Array<
t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
>,
_arguments: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder>,
): t.NewExpression {
return validateNode<t.NewExpression>({
type: "NewExpression",
Expand Down Expand Up @@ -878,9 +874,7 @@ export function optionalMemberExpression(
}
export function optionalCallExpression(
callee: t.Expression,
_arguments: Array<
t.Expression | t.SpreadElement | t.JSXNamespacedName | t.ArgumentPlaceholder
>,
_arguments: Array<t.Expression | t.SpreadElement | t.ArgumentPlaceholder>,
optional: boolean,
): t.OptionalCallExpression {
return validateNode<t.OptionalCallExpression>({
Expand Down
14 changes: 2 additions & 12 deletions packages/babel-types/src/definitions/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,7 @@ defineType("CallExpression", {
validate: chain(
assertValueType("array"),
assertEach(
assertNodeType(
"Expression",
"SpreadElement",
"JSXNamespacedName",
"ArgumentPlaceholder",
),
assertNodeType("Expression", "SpreadElement", "ArgumentPlaceholder"),
),
),
},
Expand Down Expand Up @@ -2242,12 +2237,7 @@ defineType("OptionalCallExpression", {
validate: chain(
assertValueType("array"),
assertEach(
assertNodeType(
"Expression",
"SpreadElement",
"JSXNamespacedName",
"ArgumentPlaceholder",
),
assertNodeType("Expression", "SpreadElement", "ArgumentPlaceholder"),
),
),
},
Expand Down