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

Node compat: npm: in export type ... statement is not transpiled #440

Closed
bergold opened this issue Apr 24, 2024 · 5 comments
Closed

Node compat: npm: in export type ... statement is not transpiled #440

bergold opened this issue Apr 24, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@bergold
Copy link

bergold commented Apr 24, 2024

In my package I have a deps.ts file which re-exports some stuff. One of those is the following line:

export type { ResponseCookie } from "npm:@edge-runtime/cookies@4"

(source)

The NPM compat bundle includes transpiled deps.js and deps.d.ts files, where this statement is correctly transpiled (or stripped in the case of the deps.js file)

But, in the deps.ts file this line is NOT transpiled. All other exports are correctly transpiled though. So, maybe it's related to the type keyword in there.


For reference this is the package: GitHub JSR

Maybe related #367, #377

@lucacasonato
Copy link
Member

I don't quite understand the problem - can you send me your lock file that you got after the NPM install? In the tarball, all specifiers seem to be correctly transpiled: https://npm.jsr.io/~/8/@jsr/bergold__password-middleware/1.0.1.tgz

@bergold
Copy link
Author

bergold commented Apr 24, 2024

Thank you for your quick response!

You can find the problematic file in the tarball you linked at src/deps.ts (not deps.d.ts or deps.js). The first two lines are correctly transpiled but not the third line.

Somehow my TypeScript compiler uses the deps.ts file (and not deps.d.ts) from this package for type checking and I get an error, because it can't resolve the npm: protocol import.

@lucacasonato
Copy link
Member

In the latest revision of the tarballs (https://npm.jsr.io/~/8/@jsr/bergold__password-middleware/1.0.1.tgz) the output is now fixed so that TypeScript uses the .d.ts and .js files instead of the .ts files. The transpilation issue within the .ts file persists - but it should not block importing the package anymore.

@lucacasonato lucacasonato added bug Something isn't working and removed question labels Apr 30, 2024
@bergold
Copy link
Author

bergold commented Apr 30, 2024

Thank you a lot. I can confirm, type checking is working again for me

@KnorpelSenf
Copy link

Can this be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

4 participants