- Notifications
You must be signed in to change notification settings - Fork638
Is there a way to declare a choice? Like either this or that.#2256
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
Say I want a model to be of this type: typeIngredient={productId:number;}&(|{servingId:number;amount:number;}|{weight:number;}); samples: constingrWithServing:Ingredient={productId:1,servingId:1,amount:10,};constingrWithWeight:Ingredient={productId:1,weight:100,}; Now how to refactor the constingredientModel=types.model({productId:types.number,servingId:types.number,amount:types.number,weight:types.number,}); |
BetaWas this translation helpful?Give feedback.
All reactions
Answered by coolsoftwaretylerMar 27, 2025
You probably want aunion type here.
Replies: 1 comment
-
You probably want aunion type here. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
0 replies
Answer selected bycoolsoftwaretyler
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment