This commit is contained in:
Benjamin Lichtman
2018-09-17 16:23:52 -07:00
parent a73b561dd3
commit 76b0b2f1e8
3 changed files with 43 additions and 0 deletions
@@ -421,6 +421,15 @@ function [#|f|](): Promise<void> {
return fetch('https://typescriptlang.org').then( () => console.log("almost done") ).then( () => console.log("done") );
}`
);
_testConvertToAsyncFunction("convertToAsyncFunction_IgnoreArgs4", `
function [#|f|]() {
return fetch('https://typescriptlang.org').then(res);
}
function res(){
console.log("done");
}`
);
_testConvertToAsyncFunction("convertToAsyncFunction_Method", `
class Parser {
[#|f|]():Promise<void> {
@@ -0,0 +1,17 @@
// ==ORIGINAL==
function /*[#|*/f/*|]*/() {
return fetch('https://typescriptlang.org').then(res);
}
function res(){
console.log("done");
}
// ==ASYNC FUNCTION::Convert to async function==
async function f() {
const result_1 = await fetch('https://typescriptlang.org');
return res(result_1);
}
function res(){
console.log("done");
}
@@ -0,0 +1,17 @@
// ==ORIGINAL==
function /*[#|*/f/*|]*/() {
return fetch('https://typescriptlang.org').then(res);
}
function res(){
console.log("done");
}
// ==ASYNC FUNCTION::Convert to async function==
async function f() {
const result_1 = await fetch('https://typescriptlang.org');
return res(result_1);
}
function res(){
console.log("done");
}