| 184 | { |
| 185 | // Define a class that implements the ToStreamable protocol |
| 186 | class JsonMessage { |
| 187 | constructor(private data: object) {} |
| 188 | |
| 189 | // The protocol method - returns sync streamable yield |
| 190 | [Stream.toStreamable](): string { |
| 191 | return JSON.stringify(this.data); |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | // Create a generator that yields JsonMessage objects |
| 196 | function* messageSource() { |
nothing calls this directly
no outgoing calls
no test coverage detected