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

support .ts in bundle-source #2415

Open
turadg opened this issue Aug 17, 2024 · 3 comments
Open

support .ts in bundle-source #2415

turadg opened this issue Aug 17, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@turadg
Copy link
Member

turadg commented Aug 17, 2024

What is the Problem Being Solved?

TypeScript is very popular and the JsDoc syntax for it has many limitations compared to .ts. (Some described in Agoric/agoric-sdk#5760)

A developer who wants to write in .ts can transpile before bundling with Endo, but that increases work, room for error, and the transformation chain to audit.

Description of the Design

bundle-source would bundle .ts files directly by transparently transforming them to .js using something like @swc/wasm-typescript used in Node's new .ts support.

Security Considerations

Transforming code can make it harder to audit the bundled code. But conversely, type annotations can mislead in an audit.

Given the complexities of audits and the trade-offs with runtime constraints, solving auditing will require purpose-built tooling: #1656

Scaling Considerations

Test Plan

Compatibility Considerations

Upgrade Considerations

@turadg turadg added the enhancement New feature or request label Aug 17, 2024
@mhofman
Copy link
Contributor

mhofman commented Aug 19, 2024

Striping TS types and purely replacing with whitespace may cause semantic JS difference, and some cases need special handling. Any mechanism that support TS in bundle source need to correctly handle these cases and not change the runtime semantics.

Some pointers:

@kungfooman
Copy link

Pure ESM has so many advantages... just being able to do <script type="module" src="..."></script> with an import map... TS destroys nice ESM and also makes code unreadable. Simple one liner JS functions that are easy to document with JSDoc become type monsters where you can't even differ between real code and type sugar any longer without starring at ASCII soup for 5 minutes.

For what? The beginning of the end.

@turadg
Copy link
Member Author

turadg commented Sep 27, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants