Skip to content

Commit a73fa06

Browse files
also async iterables
1 parent 811705a commit a73fa06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

normative-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ NB: This convention is new as of 2024, and most earlier parts of the language do
4040

4141
## Reject primitives in iterable-taking positions
4242

43-
Any time an iterable value (a value that has a `Symbol.iterator` method) is expected, primitives should be treated as if they were not iterable. Usually, this will mean throwing a `TypeError`. Primitive wrapper Objects such as String Objects, however, should be treated like any other Object.
43+
Any time an iterable or async-iterable value (a value that has a `Symbol.iterator` or `Symbol.asyncIterator` method) is expected, primitives should be treated as if they were not iterable. Usually, this will mean throwing a `TypeError`. Primitive wrapper Objects such as String Objects, however, should be treated like any other Object.
4444

4545
Although primitive Strings are default iterable (`String.prototype` has a `Symbol.iterator` method which enumerates code points), it is now considered a mistake to iterate a String without specifying whether the String is providing an abstraction over code units, code points, grapheme clusters, or something else.
4646

0 commit comments

Comments
 (0)