Skip to content

Commit 25d7e60

Browse files
Fix type checking
1 parent 34d0b94 commit 25d7e60

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/babel-helper-define-polyfill-provider/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { declare } from "@babel/helper-plugin-utils";
22
import type { NodePath } from "@babel/traverse";
33

4-
import _getTargets, {
4+
import getTargets, {
55
isRequired,
66
getInclusionReasons,
77
} from "@babel/helper-compilation-targets";
8-
const getTargets = _getTargets.default || _getTargets;
98

109
import { createUtilsGetter } from "./utils";
1110
import ImportsCachedInjector from "./imports-injector";

packages/babel-plugin-polyfill-corejs3/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export default defineProvider<Options>(function (
270270
coreJSPureHelper("get-iterator", useBabelRuntime, ext),
271271
"getIterator",
272272
),
273-
[node.object],
273+
[node.object as t.Expression],
274274
),
275275
);
276276
path.skip();
@@ -345,7 +345,7 @@ export default defineProvider<Options>(function (
345345
parentPath.type === "OptionalMemberExpression"
346346
? "MemberExpression"
347347
: "CallExpression";
348-
delete parentAsNotOptional.node.optional;
348+
delete parentPath.node.optional;
349349

350350
({ parentPath } = parentPath);
351351
} while (
@@ -400,7 +400,7 @@ export default defineProvider<Options>(function (
400400
path.replaceWith(check(t.callExpression(id, [node.object])));
401401
if (t.isOptionalMemberExpression(parent)) parent.optional = true;
402402
} else {
403-
path.replaceWith(t.callExpression(id, [node.object]));
403+
path.replaceWith(t.callExpression(id, [node.object as t.Expression]));
404404
}
405405
}
406406
},

packages/babel-plugin-polyfill-corejs3/src/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export function maybeMemoizeContext(
3737
context1 = t.cloneNode(object);
3838
} else {
3939
context2 = scope.generateDeclaredUidIdentifier("context");
40-
context1 = t.assignmentExpression("=", t.cloneNode(context2), object);
40+
context1 = t.assignmentExpression(
41+
"=",
42+
t.cloneNode(context2),
43+
object as t.Expression,
44+
);
4145
}
4246

4347
return [context1, context2];

0 commit comments

Comments
 (0)