@@ -280,26 +280,6 @@ extension Effect where Failure == Swift.Error {
280
280
}
281
281
}
282
282
283
- extension Effect where Output == Never {
284
- /// Upcasts an `Effect<Never, Failure>` to an `Effect<T, Failure>` for any type `T`. This is
285
- /// possible to do because an `Effect<Never, Failure>` can never produce any values to feed back
286
- /// into the store (hence the name "fire and forget"), and therefore we can act like it's an
287
- /// effect that produces values of any type (since it never produces values).
288
- ///
289
- /// This is useful for times you have an `Effect<Never, Failure>` but need to massage it into
290
- /// another type in order to return it from a reducer:
291
- ///
292
- /// case .buttonTapped:
293
- /// return analyticsClient.track("Button Tapped")
294
- /// .fireAndForget()
295
- ///
296
- /// - Returns: An effect.
297
- public func fireAndForget< T> ( ) -> Effect < T , Failure > {
298
- func absurd< A> ( _ never: Never ) -> A { }
299
- return self . map ( absurd)
300
- }
301
- }
302
-
303
283
extension Publisher {
304
284
/// Turns any publisher into an `Effect`.
305
285
///
@@ -338,14 +318,20 @@ extension Publisher {
338
318
/// and any failure.
339
319
///
340
320
/// This is useful for times you want to fire off an effect but don't want to feed any data back
341
- /// into the system.
321
+ /// into the system. It can automatically promote an effect to your reducer's domain.
342
322
///
343
323
/// case .buttonTapped:
344
324
/// return analyticsClient.track("Button Tapped")
345
325
/// .fireAndForget()
346
326
///
327
+ /// - Parameters:
328
+ /// - outputType: An output type.
329
+ /// - failureType: A failure type.
347
330
/// - Returns: An effect that never produces output or errors.
348
- public func fireAndForget< NewOutput, NewFailure> ( ) -> Effect < NewOutput , NewFailure > {
331
+ public func fireAndForget< NewOutput, NewFailure> (
332
+ outputType: NewOutput . Type = NewOutput . self,
333
+ failureType: NewFailure . Type = NewFailure . self
334
+ ) -> Effect < NewOutput , NewFailure > {
349
335
return
350
336
self
351
337
. flatMap { _ in Empty ( ) }
0 commit comments