Skip to content

Commit d0655a8

Browse files
authored
ci: work around type ambiguity in macOS 13 swift build (#609)
1 parent d81fc86 commit d0655a8

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Sources/Realtime/RealtimeChannel+AsyncAwait.swift

+10-6
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ extension RealtimeChannelV2 {
3131
filter: String? = nil
3232
) -> AsyncStream<InsertAction> {
3333
postgresChange(event: .insert, schema: schema, table: table, filter: filter)
34-
.compactMap { $0.wrappedAction as? InsertAction }
35-
.eraseToStream()
34+
.compactErase()
3635
}
3736

3837
/// Listen for postgres changes in a channel.
@@ -43,8 +42,7 @@ extension RealtimeChannelV2 {
4342
filter: String? = nil
4443
) -> AsyncStream<UpdateAction> {
4544
postgresChange(event: .update, schema: schema, table: table, filter: filter)
46-
.compactMap { $0.wrappedAction as? UpdateAction }
47-
.eraseToStream()
45+
.compactErase()
4846
}
4947

5048
/// Listen for postgres changes in a channel.
@@ -55,8 +53,7 @@ extension RealtimeChannelV2 {
5553
filter: String? = nil
5654
) -> AsyncStream<DeleteAction> {
5755
postgresChange(event: .delete, schema: schema, table: table, filter: filter)
58-
.compactMap { $0.wrappedAction as? DeleteAction }
59-
.eraseToStream()
56+
.compactErase()
6057
}
6158

6259
/// Listen for postgres changes in a channel.
@@ -126,3 +123,10 @@ extension RealtimeChannelV2 {
126123
broadcastStream(event: event)
127124
}
128125
}
126+
127+
// Helper to work around type ambiguity in macOS 13
128+
fileprivate extension AsyncStream<AnyAction> {
129+
func compactErase<T: Sendable>() -> AsyncStream<T> {
130+
AsyncStream<T>(compactMap { $0.wrappedAction as? T } as AsyncCompactMapSequence<Self, T>)
131+
}
132+
}

0 commit comments

Comments
 (0)