Skip to content

Commit

Permalink
Fix ts error
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Feb 9, 2023
1 parent e521f13 commit 95ffc6c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/babel-plugin-transform-flow-comments/src/index.ts
Expand Up @@ -143,9 +143,9 @@ export default declare(api => {
AssignmentPattern: {
exit({ node }) {
const { left } = node;
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
if (left.optional) {
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
left.optional = false;
}
},
Expand Down Expand Up @@ -238,7 +238,6 @@ export default declare(api => {
ofPath: path.get("typeAnnotation"),
toPath: path,
optional:
// @ts-expect-error optional is not in ObjectPattern
node.optional ||
// @ts-expect-error Fixme: optional is not in t.TypeAnnotation
node.typeAnnotation.optional,
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-plugin-transform-flow-strip-types/src/index.ts
Expand Up @@ -136,9 +136,9 @@ export default declare((api, opts: Options) => {

AssignmentPattern({ node }) {
if (skipStrip) return;
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
if (node.left.optional) {
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
node.left.optional = false;
}
},
Expand All @@ -159,9 +159,9 @@ export default declare((api, opts: Options) => {
// must not be a MemberExpression
param = param.left;
}
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
if (param.optional) {
// @ts-expect-error optional is not in ObjectPattern
// @ts-expect-error optional is not in TSAsExpression
param.optional = false;
}
}
Expand Down

0 comments on commit 95ffc6c

Please sign in to comment.