Skip to content

TS2748 Cannot access ambient const enums when the '--isolatedModules' flag is provided #205

@tbouffard

Description

@tbouffard

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

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 working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions