From ba443a518932554ee167b57fff4f90987131fe41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Wed, 13 Jul 2022 03:37:51 -0400 Subject: [PATCH] Refine babel-plugin-jest-hoist typings (#13011) --- packages/babel-plugin-jest-hoist/src/index.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/babel-plugin-jest-hoist/src/index.ts b/packages/babel-plugin-jest-hoist/src/index.ts index d77ff26afded..2218dcec5421 100644 --- a/packages/babel-plugin-jest-hoist/src/index.ts +++ b/packages/babel-plugin-jest-hoist/src/index.ts @@ -14,8 +14,10 @@ import { CallExpression, Expression, Identifier, + MemberExpression, Node, Program, + Super, VariableDeclaration, VariableDeclarator, callExpression, @@ -197,7 +199,9 @@ function GETTER_NAME() { } `; -const isJestObject = (expression: NodePath): boolean => { +const isJestObject = ( + expression: NodePath, +): expression is NodePath => { // global if ( expression.isIdentifier() && @@ -231,8 +235,8 @@ const isJestObject = (expression: NodePath): boolean => { return false; }; -const extractJestObjExprIfHoistable = ( - expr: NodePath, +const extractJestObjExprIfHoistable = ( + expr: NodePath, ): NodePath | null => { if (!expr.isCallExpression()) { return null;