TypeScript/tests/baselines/reference/topLevelAwait.1(module=esnext,target=es2015).errors.txt
Kagami Sascha Rosylight 2161e1852f
Add module: es2022 (#44656)
Closes #44653
2021-09-29 17:44:57 -07:00

90 lines
2.9 KiB
Plaintext

tests/cases/conformance/externalModules/index.ts(2,1): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/index.ts(46,3): error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
tests/cases/conformance/externalModules/other.ts(9,5): error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
==== tests/cases/conformance/externalModules/index.ts (2 errors) ====
export const x = 1;
await x;
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
// reparse element access as await
await [x];
await [x, x];
// reparse call as await
declare function f(): number;
await (x);
await (f(), x);
await <number>(x);
await <number>(f(), x);
// reparse tagged template as await
await ``;
await <string> ``;
// member names should be ok
class C1 {
await() {}
}
class C2 {
get await() { return 1; }
set await(value) { }
}
class C3 {
await = 1;
}
({
await() {}
});
({
get await() { return 1 },
set await(value) { }
});
({
await: 1
});
// property access name should be ok
C1.prototype.await;
// await in decorators
declare const dec: any;
@(await dec)
~~~~~
!!! error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
class C {
}
// await allowed in aliased import
import { await as _await } from "./other";
// newlines
// await in throw
throw await
1;
// await in var
let y = await
1;
// await in expression statement;
await
1;
==== tests/cases/conformance/externalModules/other.ts (1 errors) ====
const _await = 1;
// await allowed in aliased export
export { _await as await };
// for-await-of
const arr = [Promise.resolve()];
for await (const item of arr) {
~~~~~
!!! error TS1432: Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher.
item;
}