Guest User

Untitled

a guest
Oct 27th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type FormState = {
  2.     option1: number,
  3.     option2: number,
  4.     option3: number,
  5.     option4: number,
  6.     option5: number,
  7. }
  8.  
  9. type ReduxState = {
  10.     option1: [number, string, string], // mozesz miec tablice typowana na dokladnie 3 elementy
  11.     option2: number,
  12.     option3: number,
  13.     option4: number,
  14.     option5: number,
  15.     // option6
  16. }
  17.  
  18. const func = (state: ReduxState, form: FormState) =>  {
  19.     const {option1, option2, option3, ...formRest} = form;
  20.  
  21.     return {
  22.         option1: [option1, option2, option3],
  23.         ...formRest
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment