forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 199
Closed
Description
I use maxGraph v0.2.1 in a TypeScript application that activates the isolatedModules option.
Accessing to enum declared in constants generates the TS2748 error. For instance, constants.ALIGN.LEFT or constants.SHAPE.ELLIPSE.
My Proposal
maxGraph should probably not export "const enum" for interoperability reasons.
See
- https://ncjamieson.com/dont-export-const-enums/ (found via Ambient const enums are not allowed when the '--isolatedModules' flag is provided OfficeDev/microsoft-teams-library-js#267 (comment))
- Const enums are preserved when using transpileModule microsoft/TypeScript#5243
- https://www.typescriptlang.org/tsconfig#isolatedModules
We could also ban const enums with typescript-eslint.io/linting/troubleshooting#how-can-i-ban-specific-language-feature or if we absolutely must keep const enum, we should enable preserveConstEnums typescriptlang.org/tsconfig#preserveConstEnums
Notes
Be also aware of #378.
Usage of const enum in maxGraph-core prevents to use them in the Storybook TypeScript stories (in the html package) as this project uses the isolatedModules option.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working