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

adopt TypeScript .ts syntax #5760

Open
turadg opened this issue Jul 13, 2022 · 3 comments
Open

adopt TypeScript .ts syntax #5760

turadg opened this issue Jul 13, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@turadg
Copy link
Member

turadg commented Jul 13, 2022

I don't think this is going to happen but I wanted a place to collect the benefits and blockers.

What is the Problem Being Solved?

We rely on TypeScript for Intellisense, refactoring support, and fast feedback on what will fail in tests. We use the JSDoc syntax in .js and not .ts syntax.

Kinks

Challenges

  • Transpilation affects auditability
  • Build step complicates execution

Description of the Design

Probably some form of Node module loader hook, such as https://github.com/esbuild-kit/esm-loader

Or a Node wrapping runtime: https://github.com/privatenumber/ts-runtime-comparison

There will be transpilation but audits should be of built bundles, which aren't minified.

Security Considerations

Test Plan

@turadg
Copy link
Member Author

turadg commented Sep 18, 2023

@dckc
Copy link
Member

dckc commented Jun 22, 2024

conversion to .cjs module format is problematic

case in point: #9408 (comment)

here's hoping for a .ts compiler / build tool that erases the types and does nothing else; especially no conversion to .cjs. I gather esbuild is close.

@erights
Copy link
Member

erights commented Jul 25, 2024

Given recent announcements...

Let's say we assume support for a well defined subset of TS that can be, and is, turned into JS only by erasure of what is clearly only the non-JS portion of the TS code. And that any TS code (even correct TS code) outside that subset fails to compile with an explicable error. If this subset of TS does not already have a name, we should coin one.

Assuming that, and given our increasingly pervasive use of sound exo guards and patterns, and our recent helpers for bridging patterns-to-types, I think we could accept such code as production code. Not a decision yet. But I’d be interested in everyone’s view of the downsides. If no one has any downsides beyond what’s off the top of my head right now, yes, I think we could decide to do that.

Given our support for soundness, I think it is possible to learn to be adequately vigilant of the remaining unsoundness during review. Might need extra tool support to do that well, like syntax coloring to make clear what is and is not erased. But if we’re going this far I would not make those extra tools a blocker. Rather, they would just join the long list of developer tooling we need for a decent DX. Still behind tooling for a better debugging DX 😉

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

4 participants