Issue 61556
Summary clang-format does not handle async function consistently in TypeScript
Labels clang-format, typescript
Assignees
Reporter ZequanWu
    For `foo3`, clang-format removed the space between `async` and `(` which is inconsistent with `foo2`.

Input:

```
const getNumber = () => Promise.resolve(42);

const foo1 = async x => {
 console.log(x);
  const num = await getNumber();
  return num;
};

const foo2 = async (x, y) => {
  console.log(x, y);
 const num = await getNumber();
  return num;
};

const foo3 = async (x: string): Promise<number> => {
  console.log(x);
  const num = await getNumber();
  return num;
};
```

Output:

```
const getNumber = () => Promise.resolve(42);

const foo1 = async x => {
 console.log(x);
  const num = await getNumber();
  return num;
};

const foo2 = async (x, y) => {
  console.log(x, y);
 const num = await getNumber();
  return num;
};

const foo3 = async(x: string): Promise<number> => {
  console.log(x);
  const num = await getNumber();
  return num;
};
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to