"$$initial" event discussion.
See original GitHub issueHey @devanshj, in this example, TypeScript is erroring because of the “$$initial” event:
const [machine, send] = useStateMachine({
schema: {
context: t<{time: number}>(),
events: {
STOP: t<{resetTime: number}>()
}
},
context: {time: 0},
initial: 'idle',
states: {
idle: {
on: {
START: 'running',
},
effect({setContext, event}) {
setContext(() => ({ time: event?.resetTime }));
// ^- Property 'resetTime' does not exist on type '{ type: "$$initial"; }'
},
},
running: {
on: {
STOP: 'idle',
}
}
},
});
send({ type: 'STOP', resetTime: 10 });
I think it might be confusing for the user to understand what’s going on here. And since so far we’re not really using the initial event to trigger anything, I’m thinking of reverting back to start undefined
. Any objections?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
All together now: Event formats for discussions - Social in silico
In-person discussions provide a chance to hear multiple viewpoints and to delve into detailed arguments that aren't easy to present online.
Read more >successful discussion events | Science Museum Group
Practical tips on running effective discussion events with adults and schools. When you're planning the event content… Choose a topic that is controversial, ......
Read more >5 Steps for Hosting Your First Successful Event - Scandiweb
We have compiled an event (meetup, workshop, conference) organization strategy that works, with a couple of tools to help you along the way....
Read more >How to Plan an Event: a Complete Guide - Wild Apricot
The very first step in planning your event is to establish tangible goals and objectives. Start by asking yourself: Why are you organizing...
Read more >17 Tips for Turning First-Time Attendees into Event Regulars
Create a discussion group in your online community for first-time attendees. Ask staff or volunteers to moderate the discussion and answer questions. #6....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah, on a different note: I merged the beta branch into main. I’m using Github’s wiki for documentation, and it’s not branch-based: Since I’m updating them I might as well make the development happen on main.
In the future I might need a different documentation solution.
Ha nice! A little late, already got another counter xD