You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve type checking and inference for Generators and Async Generators (microsoft#30790)
* Improve typing for Generators and Async Generators
* Add TReturn and TNext to Iterator, IterableIterator, etc.
* Update ts internal Iterator to be assignable from global Iterator
* Make 'done' optional in IteratorYieldResult
* Revert Iterable and IterableIterator to simpler versions plus other fixes
* Add additional inference tests
* Added additional tests
* PR cleanup and minor async iteration type fix
* Updated diagnostics message and added non-strict tests
* Fix expected arity of Iterator/AsyncIterator
Copy file name to clipboardExpand all lines: src/compiler/diagnosticMessages.json
+32-3
Original file line number
Diff line number
Diff line change
@@ -1764,7 +1764,7 @@
1764
1764
"category": "Error",
1765
1765
"code": 2489
1766
1766
},
1767
-
"The type returned by the 'next()' method of an iterator must have a 'value' property.": {
1767
+
"The type returned by the '{0}()' method of an iterator must have a 'value' property.": {
1768
1768
"category": "Error",
1769
1769
"code": 2490
1770
1770
},
@@ -1992,7 +1992,7 @@
1992
1992
"category": "Error",
1993
1993
"code": 2546
1994
1994
},
1995
-
"The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property.": {
1995
+
"The type returned by the '{0}()' method of an async iterator must be a promise for a type with a 'value' property.": {
1996
1996
"category": "Error",
1997
1997
"code": 2547
1998
1998
},
@@ -2653,6 +2653,30 @@
2653
2653
"category": "Error",
2654
2654
"code": 2762
2655
2655
},
2656
+
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but for-of will always send '{0}'.": {
2657
+
"category": "Error",
2658
+
"code": 2763
2659
+
},
2660
+
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array spread will always send '{0}'.": {
2661
+
"category": "Error",
2662
+
"code": 2764
2663
+
},
2664
+
"Cannot iterate value because the 'next' method of its iterator expects type '{1}', but array destructuring will always send '{0}'.": {
2665
+
"category": "Error",
2666
+
"code": 2765
2667
+
},
2668
+
"Cannot delegate iteration to value because the 'next' method of its iterator expects type '{1}', but the containing generator will always send '{0}'.": {
2669
+
"category": "Error",
2670
+
"code": 2766
2671
+
},
2672
+
"The '{0}' property of an iterator must be a method.": {
2673
+
"category": "Error",
2674
+
"code": 2767
2675
+
},
2676
+
"The '{0}' property of an async iterator must be a method.": {
2677
+
"category": "Error",
2678
+
"code": 2768
2679
+
},
2656
2680
2657
2681
"Import declaration '{0}' is using private name '{1}'.": {
2658
2682
"category": "Error",
@@ -4214,7 +4238,7 @@
4214
4238
"category": "Error",
4215
4239
"code": 7024
4216
4240
},
4217
-
"Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type.": {
4241
+
"Generator implicitly has yield type '{0}' because it does not yield any values. Consider supplying a return type annotation.": {
4218
4242
"category": "Error",
4219
4243
"code": 7025
4220
4244
},
@@ -4336,6 +4360,11 @@
4336
4360
"category": "Error",
4337
4361
"code": 7054
4338
4362
},
4363
+
"'{0}', which lacks return-type annotation, implicitly has an '{1}' yield type.": {
0 commit comments