<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61556>61556</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format does not handle async function consistently in TypeScript
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format,
typescript
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ZequanWu
</td>
</tr>
</table>
<pre>
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;
};
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzslU-PmzwQxj_NcLEWOWP-HjhkkzfSe2krtVKl3gxMwJWxqW02m29fAVmFbVX1tIeVKiGDrfHveQYGj_RedYaogvQR0mMkp9BbV32jH5M0X6eotu21OlnHIONnawVkHPDAGi1N93C2bpCBORrsE7Us9MT8KBtiNYULkZk3SX81DWScSdOyZXcxzy69anqmPFOmscYrH8gEdlGhvykhZDwGfgS-X8f_zTgFEPvt2sxbr2U6kwLrKHyYhpocA3Fksx6W8yOI_9gnZwflKXbkrX4iwCJBwBLE4xa7cs7W7hbEkgJ7fmFAfgtmc5zVFGvbARbPWxBjK8RMw8q4SLWxtrraRDsKkzNz-N1LfvyTL9z4WpUP7LpJ827xd49r5F36LX2KX32KPfPBKdMt1P3L9wBxMKvebP7vObzde35dUOv4cQr_Su8dl957rLyorURbilJGVO2yvBQJZnkR9VXDizLfpYlIc2qTNG2Kui0xbxPeZkUrKVIVchRcIEfOE1HEXIqyJMpSIdusbBASToNUOtb6aYit6yLl_URVtkvTLNKyJu2XdoC4PeYBEfAAiOE6km-cGpel9Bi5aiY91FPnIeFa-eDv7KCCpupVv2gteWZsYL00raZbMZ0n0wRlDbv3A31lyrAv15E-L3rR5HTVhzD6-WfEE-CpU6Gf6rixA-BpFr3dHkZnv1MTAE9Ldh7wtCT4MwAA__9PUP9E">