diff --git a/types/jscodeshift/test/js-transforms/call-expression-bind-this-to-arrow-function-expression.ts b/types/jscodeshift/test/js-transforms/call-expression-bind-this-to-arrow-function-expression.ts index cfe672436e..09cdf3f29e 100644 --- a/types/jscodeshift/test/js-transforms/call-expression-bind-this-to-arrow-function-expression.ts +++ b/types/jscodeshift/test/js-transforms/call-expression-bind-this-to-arrow-function-expression.ts @@ -26,7 +26,7 @@ * var a = c => c; * */ -import { Transform, MemberExpression, FunctionExpression } from "jscodeshift"; +import { Transform, MemberExpression, FunctionExpression, ArrowFunctionExpression } from "jscodeshift"; const transform: Transform = (file, api) => { const j = api.jscodeshift; @@ -42,7 +42,7 @@ const transform: Transform = (file, api) => { // Grab the function body. Since we looked for the CallExpression originally, the "callee.object" would refer // to the FunctionExpression that's being called .bind(this) on. We need the body of that function // to transform into an ArrowFunctionExpression. - let body = object.body; + let body: ArrowFunctionExpression['body'] = object.body; // We can get a bit clever here. If we have a function that consists of a single return statement in it's body, // we can transform it to the more compact arrowFunctionExpression (a, b) => a + b, vs (a + b) => { return a + b } let useExpression = false; diff --git a/types/jscodeshift/test/js-transforms/function-expression-to-arrow-function-expression.ts b/types/jscodeshift/test/js-transforms/function-expression-to-arrow-function-expression.ts index 5a1b50dc6b..b960c920cd 100644 --- a/types/jscodeshift/test/js-transforms/function-expression-to-arrow-function-expression.ts +++ b/types/jscodeshift/test/js-transforms/function-expression-to-arrow-function-expression.ts @@ -25,7 +25,7 @@ * return a + b + this.c; * } */ -import { Transform } from "jscodeshift"; +import { Transform, ArrowFunctionExpression } from "jscodeshift"; const transform: Transform = (file, api) => { const j = api.jscodeshift; @@ -36,7 +36,7 @@ const transform: Transform = (file, api) => { // using the arrowFunctionExpression. As that could potentially have some unintended consequences. .filter(p => j(p).find(j.ThisExpression).size() === 0) .replaceWith(p => { - let body = p.value.body; + let body: ArrowFunctionExpression['body'] = p.value.body; // We can get a bit clever here. If we have a function that consists of a single return statement in it's body, // we can transform it to the more compact arrowFunctionExpression (a, b) => a + b, vs (a + b) => { return a + b } let useExpression = false; diff --git a/types/jscodeshift/test/js-transforms/props-to-destructuring.ts b/types/jscodeshift/test/js-transforms/props-to-destructuring.ts index 6db8fe49dd..138d61a620 100644 --- a/types/jscodeshift/test/js-transforms/props-to-destructuring.ts +++ b/types/jscodeshift/test/js-transforms/props-to-destructuring.ts @@ -135,7 +135,7 @@ const transform: Transform = (file, api) => { return j.functionExpression( p.value.id, p.value.params, - j.blockStatement([decl].concat((p.value.body as BlockStatement).body)) + j.blockStatement([decl].concat(p.value.body.body)) ); } ).toSource();