I'm running into an issue with the typescript definitions. When trying to instantiate a renderer, I need to use the enum Vex.Flow.Renderer.Backends however I can't because of the following error :
Cannot access ambient const enums when the '--isolatedModules' flag is provided
_This problem also exists for the other enums as well, I am just using the renderer backend as an example as it is mandatory to use it for using vexflow with Typescript._
I am also pretty new to Typescript therefore I'm not sure if I understand everything about enums correctly yet. From my understanding, const enums are replaced at compile time by their value and cannot be used because the object usually created by the enum is not present at runtime. However, this object (and I think all enums from this file) should be available for developers using vexflow.
Suggested change
I suggest to change all const enum to enum in vexflow type definitions to be able to use them in Typescript. I can work on a PR for this change if you think this is a correct change. If not, please explain to me why as it would greatly help me understand typescript enums better :)
I can crosspost this issue directly on DefinitelyTyped repo if this is more appropriate.
LInk to the typescript definition file
Thanks
The typescript definitions for Vexflow are a little bit out of date now. The question is whether to keep them up to date as they have been, let them vanish, or move the project itself to TypeScript. I like the last choice, but it's always up to Mohit.
Well given no further comments on this, I will look into submitting a PR with the mentioned changes to the DefinitelyTyped repo so this project can be more easily used with Typescript. I also noticed that Context::openGroup and Context::closeGroup are missing to the definitions (can more easily be dealt with by patching the types in your own project) so I will add this as well.
Pull request to definitelyTyped was merged so I close this issue
Most helpful comment
Well given no further comments on this, I will look into submitting a PR with the mentioned changes to the DefinitelyTyped repo so this project can be more easily used with Typescript. I also noticed that
Context::openGroupandContext::closeGroupare missing to the definitions (can more easily be dealt with by patching the types in your own project) so I will add this as well.