TypeScript可传递地导入ES库

TypeScript可传递地导入ES库,typescript,Typescript,我想确保我的代码没有使用比ES6更新的库功能。因此,我的tsconfig.json如下所示: { "compilerOptions": { "lib": [ "es6" ], "target": "es6", "outDir": "./dist", "rootDir": "./src", "module": "commonjs", "declaration": true, "strict": true, "m

我想确保我的代码没有使用比ES6更新的库功能。因此,我的
tsconfig.json
如下所示:

{
  "compilerOptions": {
    "lib": [
      "es6"
    ],
    "target": "es6",
    "outDir": "./dist",
    "rootDir": "./src",
    "module": "commonjs",
    "declaration": true,
    "strict": true,
    "moduleResolution": "node",
    "esModuleInterop": true
  }
}
这与预期一样有效,像
Object.fromEntries
这样的调用被标记为错误

遗憾的是,一旦我安装了一些依赖于
@types/node
的开发人员依赖项,例如一个汇总插件,TypeScript就会在
节点模块/@types/node
中找到以下声明:

/// <reference lib="es2018" />
//
(文件
node\u modules/@types/node/ts3.7/base.d.ts

突然,
Object.fromEntries
不再被标记,因为尽管我在
tsconfig.json
中进行了配置,TypeScript现在加载了ES2018库


有什么办法可以避免吗?

这似乎是一个已知的错误: