This commit is contained in:
Benjamin Lichtman
2018-09-14 17:20:46 -07:00
parent 9e1a05c9ec
commit 32cb9ece8b
3 changed files with 30 additions and 0 deletions

View File

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

View File

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

View File

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