Skip to content

Commit

Permalink
Refine babel-plugin-jest-hoist typings (#13011)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 13, 2022
1 parent f87e4c3 commit ba443a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/babel-plugin-jest-hoist/src/index.ts
Expand Up @@ -14,8 +14,10 @@ import {
CallExpression,
Expression,
Identifier,
MemberExpression,
Node,
Program,
Super,
VariableDeclaration,
VariableDeclarator,
callExpression,
Expand Down Expand Up @@ -197,7 +199,9 @@ function GETTER_NAME() {
}
`;

const isJestObject = (expression: NodePath<Expression>): boolean => {
const isJestObject = (
expression: NodePath<Expression | Super>,
): expression is NodePath<Identifier | MemberExpression> => {
// global
if (
expression.isIdentifier() &&
Expand Down Expand Up @@ -231,8 +235,8 @@ const isJestObject = (expression: NodePath<Expression>): boolean => {
return false;
};

const extractJestObjExprIfHoistable = <T extends Node>(
expr: NodePath<T>,
const extractJestObjExprIfHoistable = (
expr: NodePath,
): NodePath<Expression> | null => {
if (!expr.isCallExpression()) {
return null;
Expand Down

0 comments on commit ba443a5

Please sign in to comment.