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

Experimental forward compatible type-stripper #229

Open
fcrozatier opened this issue Dec 26, 2024 · 4 comments
Open

Experimental forward compatible type-stripper #229

fcrozatier opened this issue Dec 26, 2024 · 4 comments

Comments

@fcrozatier
Copy link

Hi, I've created a type-stripper to make it possible to experiment with this proposal today. The goal is to ensure forward compatibility, so that when the proposal reaches Stage 4, a simple change in file extensions will be all that's needed.

It throws errors for unsupported syntaxes, including auto-accessors, but not for the satisfies keyword #228

@ljharb
Copy link
Member

ljharb commented Dec 26, 2024

@fcrozatier the shape of the solution before stage 2/2.7 will likely change in many ways that guarantees you can’t have forward compatibility, in particular because TS is not a syntactic superset of JS (generics syntax, in particular).

@fcrozatier
Copy link
Author

fcrozatier commented Dec 27, 2024

The transition to annotated JS (aJS) could be seamless as the proposal doesn't introduce syntax without a TS equivalent, as far as I understand. Here's how this tool could evolve to support the transition:

[x] Stage 1+: a TS → JS stripper. Assists TS users in restricting themselves to the subset of TS syntaxes with an equivalent in annotated JS
[ ] Stage 2/2.7: an aJS → JS experimental stripper. Enables early adopters to experiment with the new annotation syntax and provide feedback
[ ] Stage 4: a TS → aJS migration tool. Transpiles TS syntax to its equivalent aJS syntax

The broader picture is a clean commutative diagram:

TS ———> JS
 |       |
 |       | id
        
aJS———> JS

@ljharb
Copy link
Member

ljharb commented Dec 27, 2024

What I’m saying is that a proposal, at stage 1, is just a problem statement, not a solution shape, so there’s nothing to implement yet.

@anacierdem
Copy link

Also from what I’ve observed from the discussions here is that the proposal stopped progressing b/c of the fact that it doesn’t seem possible to come up with a forward compatible syntax. If a syntax is locked in it’d mean ts need to stop evolving or if it is left open ended, js would need to start implementing what ts has.

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

No branches or pull requests

3 participants