mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove parens from single parameter arrow functions
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user