Skip to content

Instantly share code, notes, and snippets.

@JWLangford
Created April 13, 2021 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JWLangford/02bba075f1728e73790e2b90fd464d8d to your computer and use it in GitHub Desktop.
Save JWLangford/02bba075f1728e73790e2b90fd464d8d to your computer and use it in GitHub Desktop.
const splitUser = (user: IUser): {stateUser: IUserState, stateBilling: IBillingState} => {
const { billingInfo = initialBillingState, ...rest } = user
return {stateUser: rest, stateBilling: billingInfo}
}
const combineUserAndBilling = (user: IUserState, billingInfo: IBillingState): IUser => {
return {...user, billingInfo}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment