mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
asyncAwaitWithCapturedBlockScopeVar.ts(27,23): error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
|
|
|
|
|
|
==== asyncAwaitWithCapturedBlockScopeVar.ts (1 errors) ====
|
|
async function fn1() {
|
|
let ar = [];
|
|
for (let i = 0; i < 1; i++) {
|
|
await 1;
|
|
ar.push(() => i);
|
|
}
|
|
}
|
|
|
|
async function fn2() {
|
|
let ar = [];
|
|
for (let i = 0; i < 1; i++) {
|
|
await 1;
|
|
ar.push(() => i);
|
|
break;
|
|
}
|
|
}
|
|
|
|
async function fn3() {
|
|
let ar = [];
|
|
for (let i = 0; i < 1; i++) {
|
|
await 1;
|
|
ar.push(() => i);
|
|
continue;
|
|
}
|
|
}
|
|
|
|
async function fn4(): Promise<number> {
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2366: Function lacks ending return statement and return type does not include 'undefined'.
|
|
let ar = [];
|
|
for (let i = 0; i < 1; i++) {
|
|
await 1;
|
|
ar.push(() => i);
|
|
return 1;
|
|
}
|
|
}
|
|
|