-
Notifications
You must be signed in to change notification settings - Fork 88
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
Implement in typescript? #96
Comments
#75 an example that wouldn’t happen with this approach. |
I'd also love this since the current typings are pretty general, i could just edit those to make them more thorough but i wouldn't feel as confident to their correctness if it's not typechecked against the actual code. |
The one place where it would be problematic as far as I can tell is the overload of |
the other thing that makes this a pain in the ass in a quick 30 min attempt is that there's extensive use of |
yah i think im gonna abandon this for now or maybe just make a fork that does this stuff in a more straightforward manner for my own edification lol |
I don't think I'd rewrite in TypeScript because I don't use TypeScript myself. The typing files have served us well so far, so I don't see an issue with it. Since this library isn't going to change in radical ways we don't need to worry about the typings becoming wrong in the future. |
Going to close this, a TS rewrite is extremely unlikely at this time. |
I know this is a few years old, but I've been banging my head against xstate for about a week now. I found the docs for robot and was excited to have found a simpler and more straightforward alternative! Alas, in 2024, using a project without first-class Typescript support is out of the question for me. Regardless, thank you for the wonderful library... if I ever take on another project where type-safety isn't critical, I'm looking forward to trying it out! |
Robot has types. What problems are you having with them? |
Thanks @matthewp , I hadn't found anything in the docs about Typescript support, so assumed it didn't have it. I just took a look at the code though and the types look simple enough to work with that I think I could figure things out from the source (the xstate types on the other hand... are very dense). I'm mainly wondering about things like type hinting for state names, context, etc. since I've found native-JS projects to be a bit weaker than native-TS projects as a generalization. I think once I finish ironing out my initial machine definitions in xstate I'll take a stab at implementing in Robot also to see how it compares; I suspect Robot will be much easier to work with (but perhaps at the cost of flexibility and feature-set, which is understandable given different project goals) |
I would like to have types for const [current, send] = useMachine(machine);
send("autocomplete me please") |
@THOUSAND-SKY coming in #232 |
Would you be opposed to a PR that implements the library directly in TypeScript with an extra build step? It would ensure that the typings stay up to date and as exhaustive as it can be and add a level of safety to the actual library code. Wanted to ask before I put any time trying to do something like that.
The text was updated successfully, but these errors were encountered: