TypeScript - isolatedModules and JSON import

Viewed 2144

We are using a Babel to compile our TypeScript files and we want to use isolatedModules: true in our tsconfig.json as it is a recommended way. It, for example, throws an error when you try to re-export an interface. This is a necessary feature as Babel TypeScript compiler doesn't allow that too.

However, we need to import a JSON file in our TS file. The issue is that tsc will throws the following error:

Cannot compile namespaces when the '--isolatedModules' flag is provided.

Any idea how to import a JSON and keep type-checker happy?

1 Answers
Related