You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there is no typesafe way for me to update the key value store. This is annoying when trying to implement a state-machine pattern for the key value store.
Example:
ctx.set("Status","ACTIVE");// Context is now in non-typesafe state because Details doesn't existctx.set("Details", ...)// Get a type error because Details field isn't present when Status is "NONEXISTANT"
If we were to introduce some method to update the entire key/value state at once, we can resolve this. It would be akin to a map operation.
awaitctx.update((oldState)=>{return{Status: "ACTIVE",Details: {SomeField: 1,SomeOtherField: "hello"}}}// All fields are updated atomically and type safety is preserved
The text was updated successfully, but these errors were encountered:
Sure - but now we have to nest it arbitrarily. Plus the issue remains that you can't atomically update one or more fields within the context store at the first level
There is an issue I run into with having a typed context.
Say I have a type like:
And my context looks like:
Currently there is no typesafe way for me to update the key value store. This is annoying when trying to implement a state-machine pattern for the key value store.
Example:
If we were to introduce some method to update the entire key/value state at once, we can resolve this. It would be akin to a
map
operation.The text was updated successfully, but these errors were encountered: