Skip to content

Commit

Permalink
codemod
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed May 26, 2022
1 parent 2702dfc commit 1cbca71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
@@ -1,6 +1,7 @@
import syntaxObjectRestSpread from "@babel/plugin-syntax-object-rest-spread";
import type { PluginAPI, PluginObject } from "@babel/core";

export default function ({ types: t }) {
export default function ({ types: t }: PluginAPI): PluginObject {
return {
inherits: syntaxObjectRestSpread.default,

Expand All @@ -21,10 +22,15 @@ export default function ({ types: t }) {
const arg = args[i];
const { node } = arg;

if (arg.isObjectExpression()) {
if (t.isObjectExpression(node)) {
properties.push(...node.properties);
} else {
properties.push(t.spreadElement(node));
properties.push(
t.spreadElement(
// @ts-expect-error fixme
node,
),
);
}
}

Expand Down
@@ -1,6 +1,7 @@
import syntaxOptionalCatchBinding from "@babel/plugin-syntax-optional-catch-binding";
import type { PluginAPI, PluginObject } from "@babel/core";

export default function ({ types: t }) {
export default function ({ types: t }: PluginAPI): PluginObject {
return {
inherits: syntaxOptionalCatchBinding.default,

Expand Down

0 comments on commit 1cbca71

Please sign in to comment.