-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
TypeScript type checker #571
Comments
I'm just looking at this: https://github.com/kdy1/swc/tree/e88e5e4c824926e5f3a5240986c33bb30f7508b5/typescript/checker Won't re-writing the TS type checker in rust be a lot of work? There's so many edge cases! Why not just do what babel does and tell people to run the typescript type checker over the code with emitting? Alternatively, you could build something into the swc JS package that uses the typescript compiler api to do this as well. |
What might be neat is something that converts swc AST nodes to TypeScript compiler api nodes. So you could parse the nodes with swc, send them over to JS, convert them to typescript compiler api nodes, then it could do the type checking using those nodes. |
@dsherret I'm porting tsc because it is wall-clock grade slow. |
True, it could be faster, but there's a whole team of developers working on TypeScript daily. It will be very hard to get all the edge cases, but perhaps you could repurpose the tests the typescript team uses in the typescript repo. Anyway, you have a long and continually expanding road ahead of you :) |
I'm already using tests from typescript repository :) |
That’s awesome. Well, you’ve done an excellent job with the library and you’re very fast at programming so good luck! 😀 |
The other approach you can use with babel is do just do compilation, and run the type checker without emitting in a separate thread so even if it's slower, your build still finishes fast. That might currently work with swc? But the idea of a much faster type checker is also very exciting! |
@kdy1 what's the current status? What's the most up-to-date branch in your fork? I have a feeling you won't be able to pull this alone. Maybe we can create a plan to "move Mount Fuji" and get more people involved? |
FYI: TypeScript team doesn't have any plan to port TSC to Rust for reasons explained in tweet thread https://twitter.com/drosenwasser/status/1260722414012358657 |
We need to recruit a few developers to achieve this. |
I'm interested! I don't know if I'm up to the task, but I'll at least spend the next couple days exploring the code and getting up to speed.
|
@sciepsilon I've formed a little team together with @wongjiahau to help @kdy1 work on this. Fell free to email! |
Hi! 👋 I'm also very interested in helping with a rust port of TSC 😄, is this project public? |
@cakekindel Hi if you're interested you can join us at https://discord.gg/s8meYPV |
Sorry the link above was temporary, I just update it with a permanent one. |
i think this idea isn't really useful for check type errors (we can do it with the IDE, may be to speed up vscode) but is very cool for lib which depend on typechecks (metadata desing:type), for example in loopback there is 3 different results depending on what you use ts-node with transpile-only: error (Object) Sample repo: https://github.com/mdbetancourt/ts-node-loopback you can try changing .mocharc ts-node/register to @swc-node/register |
@kdy1 are you sure you will have better performance by porting to go? |
Yep. The main problem is the number of cpu cores it uses. Problem is not optimization |
So by porting you mean making it multithreaded too (using coroutines, channels, etc)? |
Of course. What's the point of porting to go at the first place if we are going to use only 1 core? |
This discussion about multi-threaded compilation might be relevant: microsoft/TypeScript#30235 |
Just to join the dots for anyone unaware, there's a public repo where work on |
Closing as the stc is now abandoned. TypeScript was not something that I could follow up on in an alternative language. |
Sorry to hear that, but respect you for your contributions and efforts here! |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Closing as the stc is now abandoned. TypeScript was not something that I could follow up on in an alternative language.
The text was updated successfully, but these errors were encountered: