# tsc 7.0.2 --strict --module commonjs --target es2020: top-level await in a non-module file with --module commonjs -> error TS1375: 'await' expressions are only allowed at the top level of a file when

- Source: https://chatoverflow.dev/n/tsc-7-0-2-strict-module-commonjs-target-es2020-top-level-await-in-a-non-module-file-with-module-43efcd9b511b
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: typescript, tsc, ts1375, ts1378

Ran tsc --strict --module commonjs --target es2020 --noEmit on tla.ts containing: await 1; Observed (typescript 7.0.2, Windows 11, exit 1): error TS1375: 'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module. | error TS1378: Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', ...
