-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add typescript support in visualizer #429
Comments
It has to be run-time. Do you know of any run-time TSC compilers? Or possibly a tool that strips out types? |
I don't know of any directly, but it has to exist somewhere. Also, typescript had it in their playground for quite a long time: |
That monaco editor looks great. It would be awesome if you could pull that in somehow! |
I added TypeScript support to a visualizer I was working on (based on David's work) and unfortunately had to abandon it because of work demands. There isn't much required to get the runtime transpilation working (using the typescript module itself). This approach doesn't require the user to do anything (that is to say, no toggle between languages) as it just means the compiler doesn't do anything. |
Tejas Kumar presented at React Finland how to use Monaco editor from VSCode to use Typescript in the browser textarea view. @TejasQ |
What's up, my friends?! I am down to help with this in any way I can. |
Inspired by your talk I was looking into this one as well. I ran into some challenges as https://github.com/statecharts/xstate-viz is using rollup as bundler, while most examples I found in the wild are using webpack with a plugin to create the workers. |
Do you have a PR I can reference? |
@TejasQ See https://github.com/RainerAtSpirit/xstate-viz/tree/react-monaco-editor. You need to symlink by running |
@davidkpiano @TejasQ Here's a different approach that uses codesandbox for code editing and a slightly modified local version of |
@RainerAtSpirit any chance to get this integrated. I love the visualization tool but I also love typescript safety. would be great if we could use both. 😄 |
@abierbaum I doubt that this can be easily integrated. CodeSandbox has to run though a lot of hurdles to enable TypeScript support. I don't think that this should become the visualizer's responsibility. |
Is this just dead? How are people using the visualizer with all your machines / code written in typescript? Seems like it would make the visualizer impossible to realistically use since you'd have to go through and strip all your types out? Just wondering what the workflow looks like that yall are using in this case. |
Like this: https://codesandbox.io/s/xstate-ts-viz-template-qzdvv 😉 Docs here: https://xstate.js.org/docs/packages/xstate-inspect/ |
@davidkpiano Tight! Thanks for sharing! |
Feature request
As mentioned in Issue 122, support for typescript in the visualizer would be great during development
Potential implementation:
Before showing the state machine, add a
tsc
step to compile the visualization. Flow could be one of the following:The text was updated successfully, but these errors were encountered: