Typescript error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided
Issue Summary
Hello,
I initially opened an issue on the fast-reflexes/better-react-mathjax and I was redirected here.
Here's my problem:
When running a type-check, I have the aforementioned type error with the DIRECTION enum in FontData.d.ts.
The error is resolved by changing the declaration from declare const enum to declare enum
My TypeScript version is 4.7.4, with the isolatedModules flag activated.
Steps to Reproduce:
- Having a typescript project with the
isolatedModules, my version of TS is 4.7.4 - Having mathjax as a dependency. In my case, I had fast-reflexes/better-react-mathjax, which relies on mathjax
- run a typecheck
Here's an explanation from the typescript documentation about why ambient const enums are not compatible with the isolatedModules flag
Technical details:
- MathJax Version: 3.2.2
- TS version: 4.7.4
Thanks for the report. I'll look into the effects of making that change, and whether to dump the enum entirely in favor of a constant object instead (would make it more consistent with other constants in MathJax).