MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Typescript error TS1209: Ambient const enums are not allowed when the '--isolatedModules' flag is provided

Open selimbat opened this issue 2 years ago • 1 comments

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:

  1. Having a typescript project with the isolatedModules, my version of TS is 4.7.4
  2. Having mathjax as a dependency. In my case, I had fast-reflexes/better-react-mathjax, which relies on mathjax
  3. 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

selimbat avatar Oct 12 '23 10:10 selimbat

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).

dpvc avatar Oct 17 '23 18:10 dpvc