mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Add test
This commit is contained in:
@@ -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> {
|
||||
|
||||
+17
@@ -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");
|
||||
}
|
||||
+17
@@ -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");
|
||||
}
|
||||
Reference in New Issue
Block a user