(reader: () => Promise<string>)
| 234 | ); |
| 235 | |
| 236 | const readIt = (reader: () => Promise<string>) => |
| 237 | effected(function* () { |
| 238 | return yield* read(); |
| 239 | }).handle("read", ({ resume, terminate }) => { |
| 240 | reader() |
| 241 | .then((value) => { |
| 242 | resume(value); |
| 243 | }) |
| 244 | .catch((error: unknown) => { |
| 245 | terminate(error as string); |
| 246 | }); |
| 247 | }); |
| 248 | |
| 249 | it("should run an asynchronous program", async () => { |
| 250 | { |