@@ -31,8 +31,7 @@ extension RealtimeChannelV2 {
31
31
filter: String ? = nil
32
32
) -> AsyncStream < InsertAction > {
33
33
postgresChange ( event: . insert, schema: schema, table: table, filter: filter)
34
- . compactMap { $0. wrappedAction as? InsertAction }
35
- . eraseToStream ( )
34
+ . compactErase ( )
36
35
}
37
36
38
37
/// Listen for postgres changes in a channel.
@@ -43,8 +42,7 @@ extension RealtimeChannelV2 {
43
42
filter: String ? = nil
44
43
) -> AsyncStream < UpdateAction > {
45
44
postgresChange ( event: . update, schema: schema, table: table, filter: filter)
46
- . compactMap { $0. wrappedAction as? UpdateAction }
47
- . eraseToStream ( )
45
+ . compactErase ( )
48
46
}
49
47
50
48
/// Listen for postgres changes in a channel.
@@ -55,8 +53,7 @@ extension RealtimeChannelV2 {
55
53
filter: String ? = nil
56
54
) -> AsyncStream < DeleteAction > {
57
55
postgresChange ( event: . delete, schema: schema, table: table, filter: filter)
58
- . compactMap { $0. wrappedAction as? DeleteAction }
59
- . eraseToStream ( )
56
+ . compactErase ( )
60
57
}
61
58
62
59
/// Listen for postgres changes in a channel.
@@ -126,3 +123,10 @@ extension RealtimeChannelV2 {
126
123
broadcastStream ( event: event)
127
124
}
128
125
}
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