Skip to content

Conversation

@hugoclrd
Copy link
Contributor

@hugoclrd hugoclrd commented Jun 16, 2025

fix: #1783

Disclaimers

At this stage, I'm primarily looking for architectural feedback. The current process is to:

  • Convert the TS code into an intermediate representation (IR), mostly to get the top-level definitions
  • Transpile this IR in Clarity PSEs
    • There's a sub-step here that handles function bodies
  • Format the PSEs to Clarity code with the Clarity formatters

  • There are still thousands of syntax decisions to take and nitpicking to do; this is not the focus of this particular PR and will be addressed 1 by 1 on separate GitHub issues or discussions
  • This is only one half of the project; the other half is the Clarity standard TS lib definition (available in this repo - private)
    • In TS tooling, the approach is often to let the tooling (such as eslint) handle the type safety, because there are no other TS type implementations than the official JS one (and the recent port in Go). That's the approach of SWC and OXC. They will happily transpile invalid TS code into JS
    • There is currently a similar approach. ts2clar will have some support for basic type-inference at some point, and the error handling for invalid code will need to be greatly improved for v1.

@codecov
Copy link

codecov bot commented Jun 16, 2025

@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 3 times, most recently from 7c5257a to 8a6778d Compare June 24, 2025 12:31
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 3 times, most recently from e0c2b73 to 3e8d7ba Compare June 30, 2025 07:48
@hugoclrd hugoclrd mentioned this pull request Jul 1, 2025
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 3 times, most recently from 37df04b to c2c467d Compare July 28, 2025 10:07
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 2 times, most recently from d69c3fe to c6e8534 Compare July 28, 2025 21:30
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 2 times, most recently from 61bdc29 to bcca159 Compare August 8, 2025 17:03
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 4 times, most recently from 54af3f2 to 4e8722b Compare August 28, 2025 20:28
@hugoclrd hugoclrd force-pushed the feat/ts-to-clar branch 2 times, most recently from 19b6003 to 14c38d3 Compare September 15, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transpiler PoC (v0)

3 participants