Remove parens from single parameter arrow functions

This commit is contained in:
Markus Johnsson
2018-03-03 06:58:47 +01:00
parent 67eb6fc859
commit 1e058cd1d7
+2 -2
View File
@@ -110,13 +110,13 @@ namespace ts.codefix {
export function createMethodFromCallExpression(context: CodeFixContextBase, { typeArguments, arguments: args }: CallExpression, methodName: string, inJs: boolean, makeStatic: boolean): MethodDeclaration {
const checker = context.program.getTypeChecker();
const types = map(args,
(arg) => {
arg => {
let type = checker.getTypeAtLocation(arg);
// Widen the type so we don't emit nonsense annotations like "function fn(x: 3) {"
type = checker.getBaseTypeOfLiteralType(type);
return checker.typeToTypeNode(type);
});
const names = map(args, (arg) =>
const names = map(args, arg =>
isIdentifier(arg) ? arg.text :
isPropertyAccessExpression(arg) ? arg.name.text : undefined);
return createMethod(