Q:

TypeScript - module.exports throws error TS2591: Cannot find name 'module'

I have a file called config.ts which contains following code:
let config = {
  foo: {
    bar: [{env: "test"}...],
    ...
    ...
  }
};

module.exports = config;

I'd like to use this file application-wide.
However, this code results in the following error: 
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;

I have checked that I have @types/node installed and tsconfig.json file contains "types": ["node"] under compilerOptions.
How can this issue be resolved?

A:

From How to export object in Typescript: 
Try export default config instead of modules.exports = config.

