I had this problem after adding a TypeScript JSX file (.tsx extension) using the Visual studio "add new item" feature, even though I did have esModuleInterop=true
in my tsconfig. None of my other tsx modules gave this error and I found if I add a new text file and just rename it to .tsx the error doesn't occur.
After much hunting around, the culprit seems to be these lines which had been added to the csproj by visual studio
<ItemGroup>
<None Remove="ClientApp\src\public\foo.tsx" />
</ItemGroup>
<ItemGroup>
<TypeScriptCompile Include="ClientApp\src\public\foo.tsx" />
</ItemGroup>
I deleted them from the csproj and the error went away