Skip to content

Instantly share code, notes, and snippets.

@mbrandonw
Created April 14, 2020 19:19
Show Gist options
  • Select an option

  • Save mbrandonw/f95adea285e8769efb6e24381f47969c to your computer and use it in GitHub Desktop.

Select an option

Save mbrandonw/f95adea285e8769efb6e24381f47969c to your computer and use it in GitHub Desktop.
extension Publisher where Failure == Never {
func promoteError<E>(_ errorType: E.Type = E.self) -> AnyPublisher<Output, E> {
func never<A>(_ never: Never) -> A {}
return self
.mapError(never)
.eraseToAnyPublisher()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment