-
|
Hi! I have an input like Is there a way to solve this on the model-level automatically (transparently) like casting? I wouldn't like to make an action for every such case, especially because it would prevent me from updating entities the easy way as it was recommended here: applySnapshot(this.selectedProduct, { ...getSnapshot(this.selectedProduct), ...rest }); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
There's a few ways to accomplish this:
(1) would be my recommendation, unless you're going to have a lot of different places that are passing in strings. |
Beta Was this translation helpful? Give feedback.

So the generic parameters are:
You have two:
S, the snapshot type, used for both inputs and outputs; andT, the "instance" type.For a custom type
C, you'll have the following:SnapshotIn<C> == S | TInstance<C> == TSnapshotOut<C> == SIn other words,
Sis the same on the way in as it is on the way out.Product["prop"]should just benumber, I believe.