Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
selimbat opened this issue Oct 12, 2023 · 1 comment
Labels
Accepted Issue has been reproduced by MathJax team Merged Merged into develop branch v3 v4
Milestone

Comments

@selimbat
Copy link

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
@dpvc
Copy link
Member

dpvc commented Oct 17, 2023

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 dpvc added Accepted Issue has been reproduced by MathJax team Investigate labels Oct 17, 2023
dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 25, 2023
@dpvc dpvc added this to the v4.0 milestone Nov 25, 2023
dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 28, 2023
Make const enum into a regular object.  (mathjax/MathJax#3114)
@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Merged Merged into develop branch v3 v4
Projects
None yet
Development

No branches or pull requests

2 participants