Skip to content

Ability to define each variant individually #40

Description

@sledorze

Enabling creating several unions from some variants

const success = ofType<AddActionSuccess>()
const failure = ofType<AddActionFailure>()
const error = ofType<AddActionError>()

export const addAction = unionize({
  success,
  failure
})

export const addAction2 = unionize({
  success,
  failure,
  error
})

and also using the predicates and constructor from each variant, individually (while preserving usage from the union too!)

const success = ofType<AddActionSuccess>()
success.is(...) // predicate
success.of(...) // constructor

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions