Skip to content

Commit c73c3d7

Browse files
authored
Update generators.md
1 parent 54f00bd commit c73c3d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/generators.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ const nextThing = iterator.next('bar');
101101
```
102102

103103
Since `yield` returns the parameter passed to the iterator's `next` function, and all iterators' `next` functions accept a parameter of any type, TypeScript will always assign the `any` type to the result of the `yield` operator (`bar` above).
104-
You are on your own to coerce the result to the type you expect, and ensure that only values of that type are passed to next (such as by scaffolding an additional type-enforcement layer that calls `next` for you.)
105-
If strong typing is important to you, you may want to avoid two-way communication altogether, as well as packages that rely heavily on it (e.g., redux-saga).
104+
105+
> You are on your own to coerce the result to the type you expect, and ensure that only values of that type are passed to next (such as by scaffolding an additional type-enforcement layer that calls `next` for you.) If strong typing is important to you, you may want to avoid two-way communication altogether, as well as packages that rely heavily on it (e.g., redux-saga).
106106
107107
The following example demonstrates `iterator.throw(error)`:
108108

0 commit comments

Comments
 (0)