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

I had the same problem and I added tsconfig.json into the root directory of my project.

{
    "compilerOptions": {
        "isolatedModules": false
    }
}

I didn't have the time to dive into it, but it solved the problem.


I faced similar issue in react + ts. I had commented out all my code.

Turns out A global file cannot be compiled using '--isolatedModules'. Ensure your file contains imports, exports, or an 'export {}' statement.

So, added something like:

export const foo = 'foo';

or

export {}

It's a temporary solution, else you can delete the file with commented code or update tsconfig.json