napi-rs / node-rs

Node.js bindings ❤️ Rust crates
https://node-rs.dev
MIT License
1.03k stars 32 forks source link

Consider using not-const enums to be compatible with `isolatedModules` #809

Open davidyuk opened 3 months ago

davidyuk commented 3 months ago
import { Algorithm } from '@node-rs/argon2';
console.log(Algorithm.Argon2d);

when I'm running tsc, it fails with

src/index.ts:2:13 - error TS2748: Cannot access ambient const enums when 'isolatedModules' is enabled.

I have isolatedModules switched on because I'm using Babel to compile my project.

To fix this problem would be best to export usual enums instead of const enum. Related articles: