Commit 95b2bb8
Fix Generator type
In the TypeScript definition:
```
interface Generator<T = unknown, TReturn = any, TNext = any>
```
setting `TNext` to `null` can cause a typing error when `strictNullChecks` is enabled. For example:
```
error TS2763: Cannot iterate value because the 'next' method of its iterator expects type 'null', but for-of will always send 'undefined'.
288 for (const d of data) {
~~~~
```
(from uwdata/mosaic#792 (comment))
While the strict type for `TNext` should technically be `undefined`, since this generator function does not make use of the value passed to `.next()`, it's more flexible to keep it as `any`. This is the default type and helps avoid blocking compatibility with libraries that may pass a value to `.next()` (even if that value is unused in this generator).1 parent 1584777 commit 95b2bb8
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
0 commit comments