An easy way to switch a method/function async or not async/normal
-
Toggle Async
- select the method/function line you wanna toggle in a
*.ts
or*.js
file - press
F1
and select the command - or use the shortcut key
ctrl+t ctrl+a
which meansT
oggleA
sync
- select the method/function line you wanna toggle in a
-
afun
snippets for a new async function
async function foo(): Promise<void> { return new Promise<void>((resolve, reject) => { }); }
-
amethod
snippets for a new async method
public async foo(): Promise<void> { return new Promise<void>((resolve, reject) => { }); }