我有一个名为config.ts
的文件,其中包含以下代码:
let config = {
foo: {
bar: [{env: "test"}...],
...
...
}
};
module.exports = config;
我想在整个应用程序中使用这个文件。
然而,这段代码会导致以下错误:
ERROR in src/app/configs/config.ts:357:1 - error TS2591: Cannot find name 'module'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig.
357 module.exports = config;
我已经检查过,我的@types/node
已经安装,并且tsconfig.json
文件在compilerOptions
下包含了"types": ["node"]
。
如何解决这个问题?