Skip to content

Commit 3d993e2

Browse files
Symbol docstrings (#7983)
1 parent c3dc0dc commit 3d993e2

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

packages/@rescript/runtime/Stdlib_Symbol.resi

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,20 +85,97 @@ Symbol.toString(sym) == "Symbol(sym1)"
8585
@send
8686
external toString: t => string = "toString"
8787

88+
/**
89+
`asyncIterator` is the well-known symbol used by asynchronous iterables.
90+
91+
See [`Symbol.asyncIterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator) on MDN.
92+
*/
8893
@val @scope("Symbol")
8994
external asyncIterator: t = "asyncIterator"
95+
96+
/**
97+
`hasInstance` is used by custom `instanceof` checks.
98+
99+
See [`Symbol.hasInstance`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance) on MDN.
100+
*/
90101
@val @scope("Symbol")
91102
external hasInstance: t = "hasInstance"
103+
104+
/**
105+
`isConcatSpreadable` controls whether objects are flattened when passed to `Array.concat`.
106+
107+
See [`Symbol.isConcatSpreadable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/isConcatSpreadable) on MDN.
108+
*/
92109
@val @scope("Symbol") external isConcatSpreadable: t = "isConcatSpreadable"
110+
111+
/**
112+
`iterator` is returned by objects that can be iterated with `for..of`.
113+
114+
See [`Symbol.iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator) on MDN.
115+
*/
93116
@val @scope("Symbol") external iterator: t = "iterator"
117+
118+
/**
119+
`match` customises how values respond to `String.prototype.match`.
120+
121+
See [`Symbol.match`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/match) on MDN.
122+
*/
94123
@val @scope("Symbol") external match: t = "match"
124+
125+
/**
126+
`matchAll` customises how values respond to `String.prototype.matchAll`.
127+
128+
See [`Symbol.matchAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/matchAll) on MDN.
129+
*/
95130
@val @scope("Symbol") external matchAll: t = "matchAll"
131+
132+
/**
133+
`replace` customises how values respond to `String.prototype.replace`.
134+
135+
See [`Symbol.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/replace) on MDN.
136+
*/
96137
@val @scope("Symbol") external replace: t = "replace"
138+
139+
/**
140+
`search` customises how values respond to `String.prototype.search`.
141+
142+
See [`Symbol.search`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/search) on MDN.
143+
*/
97144
@val @scope("Symbol") external search: t = "search"
145+
146+
/**
147+
`species` lets constructors return a different derived constructor when methods create new instances.
148+
149+
See [`Symbol.species`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/species) on MDN.
150+
*/
98151
@val @scope("Symbol") external species: t = "species"
152+
153+
/**
154+
`split` customises how values respond to `String.prototype.split`.
155+
156+
See [`Symbol.split`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/split) on MDN.
157+
*/
99158
@val @scope("Symbol") external split: t = "split"
159+
160+
/**
161+
`toPrimitive` customises how objects convert to primitive values.
162+
163+
See [`Symbol.toPrimitive`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive) on MDN.
164+
*/
100165
@val @scope("Symbol") external toPrimitive: t = "toPrimitive"
166+
167+
/**
168+
`toStringTag` customises the default tag shown by `Object.prototype.toString`.
169+
170+
See [`Symbol.toStringTag`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag) on MDN.
171+
*/
101172
@val @scope("Symbol") external toStringTag: t = "toStringTag"
173+
174+
/**
175+
`unscopables` marks properties that should be skipped by `with`.
176+
177+
See [`Symbol.unscopables`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/unscopables) on MDN.
178+
*/
102179
@val @scope("Symbol") external unscopables: t = "unscopables"
103180

104181
/**

0 commit comments

Comments
 (0)