-
Notifications
You must be signed in to change notification settings - Fork 47
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
Api changes for sendT
#72
Conversation
devanshj
commented
Aug 3, 2021
Interesting, not what I was expecting. I thought we were going for |
Ha I thought it was apparent in the article haha. To explain why it's like that we need the discriminating property one level deep make the narrowing happen, hence With your version, Moreover with shouldSendT(this: X, event: Y): this is Z And hence the users should probably not use destructuring as it might make the type predicate not work. Moreover I'm not sure if I haven't really tried any of this out though haha probably I should. |
Can you try it before we merge? Another question: Can I update the existing examples to use rest in the destructuring? Like: const {send, ...machine} = useStateMachine({...})
|
Yep will do.
I'd say prefer not to, because in typescript's eyes |
There... Will have to introduce And destructuring obviously won't work nor typescript would allow it at places I've defined Though we can't have the error messages that I wanted to have like Anyway, the point was to see if we can leverage EDIT: Wait given that folks will have to use |
It feels like |
We should implement The reason I was suggesting we should already have So I guess first we should merge this and then I'll open a separate PR for Edit: Oh I realized this has conflicts haha will resolve |
Ohh, got it. Yeah, I think it might make sense to release it with sendT then. |
machine = { ...machineInstant, send } Machine.State -> Machine machineState -> machineInstant machineState.value -> machineInstant.state Machine.StateValue -> Machine.State
49ff6f6
to
68eeffe
Compare
Will resume working on the documentation once this (that includes #76) is released so as to not redo the work as the api has changed |
Just released it, @devanshj |
Great! Could you merge and release this PR too? (As this PR has the finalized api to be documented) |
Hey @devanshj, Since I've been stuck as work for a while and the library have been steadily increasing, I reverted back and released Beta 3 as 1.0.0. I'm reopening this, we can further discuss releasing it as 2.0.0 |
Sure no problems, indeed we can release it as v2. I've been busy too haha, looking forward to continue working on this library! |