Giter VIP home page Giter VIP logo

Comments (4)

lowfront avatar lowfront commented on August 23, 2024

I think this is necessary, too. We can only communicate with the machine through events in XState, but the event type is currently using as string type. I tend to use enum for convenience of management because the type of event can be used in both machines and communication. Think about when you just want to rename an event type for readability. Enum allows you to find and change where you used the event type. Otherwise, you must manually find and change the event type string.

When saving VSCode's XState Visual Editor, the editor changes the modified content in the code. However, actions created in line are excluded. Considering this method of operation, I think we can add this function by excluding keys entered by Computed property names from the code change.

from xstate-tools.

davidkpiano avatar davidkpiano commented on August 23, 2024

There are some unanswered questions with supporting a feature like this:

  • What if an event type is changed in the editor? Should Typegen try to look for the proper enum or use a string?
  • What if a new event type is added? Should Typegen try to add a new enum, use a string, or change the existing enum if that was the only place it was used?
  • If the enum is changed, what if the enum is used in other places other than the machine? What should be done?

There's a lot of ambiguity that arises when trying to make Typegen "read your mind", as the number of potential ways a machine can be authored grow.

from xstate-tools.

lowfront avatar lowfront commented on August 23, 2024

I checked the link after leaving a comment. If I used Typegen, I was able to obtain the type estimation more comfortably and accurately than manually entering the type. I also overlooked that the editor can change the event name and state name. Unlike my previous comment, I think it's not a simple task.

I didn't use Typegen, but when I applied Typegen as shown in the link, I thought I didn't have to use enum. If you haven't used it, I recommend that you try it. @nicholas570

from xstate-tools.

nicholas570 avatar nicholas570 commented on August 23, 2024

@lowfront thanks, I'll try it 😉

from xstate-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.