Add tests for destructuring from variable with inferrable type
This commit is contained in:
parent
af498eb6ca
commit
680d18207c
1 changed files with 17 additions and 0 deletions
|
@ -655,6 +655,17 @@ function [#|innerPromise|](): Promise<string> {
|
|||
`
|
||||
);
|
||||
|
||||
_testConvertToAsyncFunction("convertToAsyncFunction_InnerPromiseRetBinding4", `
|
||||
function [#|innerPromise|](): Promise<string> {
|
||||
return fetch("https://typescriptlang.org").then(resp => {
|
||||
return resp.blob().then(({ blob }: { blob: { byteOffset: number } }) => [0, blob.byteOffset]).catch(({ message }: Error) => ['Error ', message]);
|
||||
}).then(([x, y]) => {
|
||||
return (x || y).toString();
|
||||
});
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
_testConvertToAsyncFunctionFailed("convertToAsyncFunction_VarReturn01", `
|
||||
function [#|f|]() {
|
||||
let blob = fetch("https://typescriptlang.org").then(resp => console.log(resp));
|
||||
|
@ -1221,6 +1232,12 @@ const { length } = [#|function|] () {
|
|||
function [#|f|]() {
|
||||
return Promise.resolve().then(x => 1).catch(x => "a").then(x => !!x);
|
||||
}
|
||||
`);
|
||||
|
||||
_testConvertToAsyncFunction("convertToAsyncFunction_catchBlockUniqueParamsBindingPattern", `
|
||||
function [#|f|]() {
|
||||
return Promise.resolve().then(() => ({ x: 3 })).catch(() => ({ x: "a" })).then(({ x }) => !!x);
|
||||
}
|
||||
`);
|
||||
|
||||
_testConvertToAsyncFunction("convertToAsyncFunction_bindingPattern", `
|
||||
|
|
Loading…
Reference in a new issue