File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -147,3 +147,18 @@ struct OutputBlockingWorkflow<Child: AnyWorkflowConvertible>: Workflow {
147147 . rendered ( in: context)
148148 }
149149}
150+
151+ // MARK: -
152+
153+ extension AnyWorkflowConvertible where Output == Never {
154+ /// A convenience for workflows that don't produce output but want to change the declared output type.
155+ ///
156+ /// This equivalent to `.mapOutput { switch $0 {} }` but avoids the compiler warning for unreachable code in the provided transform.
157+ public func mapOutput< NewOutput> ( ) -> AnyWorkflow < Rendering , NewOutput > {
158+ asAnyWorkflow ( ) . mapOutput ( silenceUnreachableWarning ( _: ) )
159+ }
160+
161+ private func silenceUnreachableWarning< T> (
162+ _ input: Never
163+ ) -> T { fatalError ( " unreachable " ) }
164+ }
You can’t perform that action at this time.
0 commit comments