mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Add and update tests
This commit is contained in:
parent
906fbae37b
commit
95e5f7d55a
@ -1198,6 +1198,15 @@ const [#|foo|] = function () {
|
||||
function [#|f|]() {
|
||||
return Promise.resolve().then(x => 1).catch(x => "a").then(x => !!x);
|
||||
}
|
||||
`);
|
||||
|
||||
_testConvertToAsyncFunction("convertToAsyncFunction_bindingPattern", `
|
||||
function [#|f|]():Promise<void> {
|
||||
return fetch('https://typescriptlang.org').then(res);
|
||||
}
|
||||
function res({ status, trailer }){
|
||||
console.log(status);
|
||||
}
|
||||
`);
|
||||
|
||||
});
|
||||
|
||||
@ -13,5 +13,6 @@ function /*[#|*/f/*|]*/(): Promise<string> {
|
||||
async function f(): Promise<string> {
|
||||
const resp = await fetch("https://typescriptlang.org");
|
||||
var blob = resp.blob().then(blob_1 => blob_1.byteOffset).catch(err => 'Error');
|
||||
const blob_2 = undefined;
|
||||
return blob_2.toString();
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
// ==ORIGINAL==
|
||||
|
||||
function /*[#|*/f/*|]*/():Promise<void> {
|
||||
return fetch('https://typescriptlang.org').then(res);
|
||||
}
|
||||
function res({ status, trailer }){
|
||||
console.log(status);
|
||||
}
|
||||
|
||||
// ==ASYNC FUNCTION::Convert to async function==
|
||||
|
||||
async function f():Promise<void> {
|
||||
const __0 = await fetch('https://typescriptlang.org');
|
||||
return res(__0);
|
||||
}
|
||||
function res({ status, trailer }){
|
||||
console.log(status);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user