From 9f4a46ce16c9a50e0881ca6364566cab1375a414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Fri, 10 Jun 2022 14:22:44 -0400 Subject: [PATCH] Update packages/babel-plugin-transform-for-of/src/index.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Nicolò Ribaudo --- packages/babel-plugin-transform-for-of/src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/babel-plugin-transform-for-of/src/index.ts b/packages/babel-plugin-transform-for-of/src/index.ts index 1ba8fb9add42..b940c4c16baa 100644 --- a/packages/babel-plugin-transform-for-of/src/index.ts +++ b/packages/babel-plugin-transform-for-of/src/index.ts @@ -206,9 +206,9 @@ export default declare((api, options: Options) => { const right = path.get("right"); if ( right.isArrayExpression() || - right.isGenericType("Array") || - // todo(Babel 8): the following line can be removed as it is supported by isGenericType("Array") - t.isArrayTypeAnnotation(right.getTypeAnnotation()) + (process.env.BABEL_8_BREAKING + ? right.isGenericType("Array") + : right.isGenericType("Array") || t.isArrayTypeAnnotation(right.getTypeAnnotation())) ) { path.replaceWith(_ForOfStatementArray(path)); return;