Aleph-Alpha / ts-rs

Generate TypeScript bindings from Rust types
MIT License
1.15k stars 115 forks source link

Add `import-esm` flag #192

Closed escritorio-gustavo closed 10 months ago

escritorio-gustavo commented 10 months ago

Add a feature flag called import-esm to add the .js extension at the end of file paths in TS import statements

Fixes #152

NyxCode commented 10 months ago

Hey, thanks for the PR. I think this is a good change, though I'm growing more and more uncomfortable by cargo features being the only way to really configure anything. That being said, I don't see any better option right now.

Could you move the changes from the README.md into the doc comment in ts-rs/lib.rs, and generate the README as described in CONTRIBUTING.md?

escritorio-gustavo commented 10 months ago

Could you move the changes from the README.md into the doc comment in ts-rs/lib.rs, and generate the README as described in CONTRIBUTING.md?

Done, sorry I totally skipped on reading it.

I'm growing more and more uncomfortable by cargo features being the only way to really configure anything.

I see... there really are a lot of cargo features going on. For this specific PR it's probably the only way to go due to ESM imports being kind of a global config on the TS side, but for future PRs what do you think should be the way to go?

NyxCode commented 10 months ago

I've added a check in the CI pipeline for that, so that we dont miss that in the future.

NyxCode commented 10 months ago

I had to re-generate the README since the encoding (remote: UTF-8, branch: UTF16-LE) differed. Idk where that happened, but I guess we'll figure that out on the next PR.

escritorio-gustavo commented 10 months ago

It seems to be my computer. Whenever I run the cargo readme command the README decides to double in size