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

const enum exports are unusable for downstream packages #821

Open
jflatow opened this issue Feb 26, 2025 · 2 comments
Open

const enum exports are unusable for downstream packages #821

jflatow opened this issue Feb 26, 2025 · 2 comments

Comments

@jflatow
Copy link

jflatow commented Feb 26, 2025

When trying to use e.g. SpecId, the enums exported are unusable in downstream packages that use Deno (or isolateModules generally):

TS2748 [ERROR]: Cannot access ambient const enums when 'isolatedModules' is enabled.

when you try to reference a value of the enum.

The main enums in question are generated in this file: https://github.com/NomicFoundation/edr/blob/main/crates/edr_napi/index.d.ts

@fvictorio
Copy link
Member

@jflatow can you give us minimal reproduction steps?

@jflatow
Copy link
Author

jflatow commented Feb 26, 2025

@jflatow can you give us minimal reproduction steps?

Sure - put the following in a file, say example.ts:

import { SpecId } from "npm:@nomicfoundation/edr";

Deno.test("does not compile", async () => {
    console.log("latest", SpecId.Latest);
});

Run:

$ deno test example.ts
Check file:///example.ts
TS2748 [ERROR]: Cannot access ambient const enums when 'isolatedModules' is enabled.
    console.log("latest", SpecId.Latest);
                          ~~~~~~
    at file:///example.ts:4:27

error: Type checking failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Inbox
Development

No branches or pull requests

2 participants