Skip to content

Commit ba443a5

Browse files
authoredJul 13, 2022
Refine babel-plugin-jest-hoist typings (#13011)
1 parent f87e4c3 commit ba443a5

File tree

1 file changed

+7
-3
lines changed
  • packages/babel-plugin-jest-hoist/src

1 file changed

+7
-3
lines changed
 

‎packages/babel-plugin-jest-hoist/src/index.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ import {
1414
CallExpression,
1515
Expression,
1616
Identifier,
17+
MemberExpression,
1718
Node,
1819
Program,
20+
Super,
1921
VariableDeclaration,
2022
VariableDeclarator,
2123
callExpression,
@@ -197,7 +199,9 @@ function GETTER_NAME() {
197199
}
198200
`;
199201

200-
const isJestObject = (expression: NodePath<Expression>): boolean => {
202+
const isJestObject = (
203+
expression: NodePath<Expression | Super>,
204+
): expression is NodePath<Identifier | MemberExpression> => {
201205
// global
202206
if (
203207
expression.isIdentifier() &&
@@ -231,8 +235,8 @@ const isJestObject = (expression: NodePath<Expression>): boolean => {
231235
return false;
232236
};
233237

234-
const extractJestObjExprIfHoistable = <T extends Node>(
235-
expr: NodePath<T>,
238+
const extractJestObjExprIfHoistable = (
239+
expr: NodePath,
236240
): NodePath<Expression> | null => {
237241
if (!expr.isCallExpression()) {
238242
return null;

0 commit comments

Comments
 (0)
Please sign in to comment.