Skip to content

Commit

Permalink
supress node path union typing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jul 8, 2022
1 parent 54817c7 commit 59bd8e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions packages/babel-helpers/src/index.ts
Expand Up @@ -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(
Expand Down
Expand Up @@ -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"),
Expand Down Expand Up @@ -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";
Expand Down

0 comments on commit 59bd8e0

Please sign in to comment.