This commit is contained in:
Benjamin Lichtman
2018-09-14 16:33:46 -07:00
parent 2c881fd90a
commit 853afd9d56
3 changed files with 30 additions and 0 deletions

View File

@@ -1132,6 +1132,12 @@ function [#|f|]() {
const [#|foo|] = function () {
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
}
`);
_testConvertToAsyncFunction("convertToAsyncFunction_simpleFunctionExpressionWithName", `
const foo = function [#|f|]() {
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
}
`);
_testConvertToAsyncFunction("convertToAsyncFunction_catchBlockUniqueParams", `

View File

@@ -0,0 +1,12 @@
// ==ORIGINAL==
const foo = function /*[#|*/f/*|]*/() {
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
}
// ==ASYNC FUNCTION::Convert to async function==
const foo = async function f() {
const result = await fetch('https://typescriptlang.org');
console.log(result);
}

View File

@@ -0,0 +1,12 @@
// ==ORIGINAL==
const foo = function /*[#|*/f/*|]*/() {
return fetch('https://typescriptlang.org').then(result => { console.log(result) });
}
// ==ASYNC FUNCTION::Convert to async function==
const foo = async function f() {
const result = await fetch('https://typescriptlang.org');
console.log(result);
}