diff --git a/packages/babel-helper-member-expression-to-functions/src/index.ts b/packages/babel-helper-member-expression-to-functions/src/index.ts index efaf7293366c..436c61c43e38 100644 --- a/packages/babel-helper-member-expression-to-functions/src/index.ts +++ b/packages/babel-helper-member-expression-to-functions/src/index.ts @@ -215,9 +215,12 @@ const handle = { ); } + // @ts-expect-error isOptionalMemberExpression does not work with NodePath union const startingNode = startingOptional.isOptionalMemberExpression() - ? startingOptional.node.object - : startingOptional.node.callee; + ? // @ts-expect-error isOptionalMemberExpression does not work with NodePath union + startingOptional.node.object + : // @ts-expect-error isOptionalMemberExpression does not work with NodePath union + startingOptional.node.callee; const baseNeedsMemoised = scope.maybeGenerateMemoised(startingNode); const baseRef = baseNeedsMemoised ?? startingNode; diff --git a/packages/babel-helpers/src/index.ts b/packages/babel-helpers/src/index.ts index cf8c3c28601e..64098b7c20c3 100644 --- a/packages/babel-helpers/src/index.ts +++ b/packages/babel-helpers/src/index.ts @@ -59,6 +59,7 @@ function getHelperMetadata(file: File): HelperMetadata { } if ( child.get("specifiers").length !== 1 || + // @ts-expect-error isImportDefaultSpecifier does not work with NodePath union !child.get("specifiers.0").isImportDefaultSpecifier() ) { throw child.buildCodeFrameError( diff --git a/packages/babel-plugin-proposal-optional-chaining/src/transform.ts b/packages/babel-plugin-proposal-optional-chaining/src/transform.ts index 313d5206cb12..e9c693592927 100644 --- a/packages/babel-plugin-proposal-optional-chaining/src/transform.ts +++ b/packages/babel-plugin-proposal-optional-chaining/src/transform.ts @@ -37,6 +37,7 @@ function needsMemoize( ) { const { node } = optionalPath; const childPath = skipTransparentExprWrappers( + // @ts-expect-error isOptionalMemberExpression does not work with NodePath union optionalPath.isOptionalMemberExpression() ? optionalPath.get("object") : optionalPath.get("callee"), @@ -87,7 +88,7 @@ export function transform( if (node.optional) { optionals.push(node); } - + // @ts-expect-error isOptionalMemberExpression does not work with NodePath union if (optionalPath.isOptionalMemberExpression()) { // @ts-expect-error todo(flow->ts) avoid changing more type optionalPath.node.type = "MemberExpression";