TypeScript无法重新声明块范围变量

在报错的文件底部添加一行代码:export {}。

在 Typescript 中,只要文件存在 import 或 export 关键字,都被视为 module

  1. // 只要文件存在 import 或 export 关键字,都被视为 module
  2. export {}

浏览器端exports is not defined

设置tsconfig.json的module模快不为CommonJs

  1. -- "module": "CommonJS"
  2. ++ "module": "es6",

tsc 编译—project带上tsconfig.json

https://www.tslang.cn/docs/handbook/tsconfig-json.html