Skip to content

Commit 0326321

Browse files
committed
check
1 parent 5520d1d commit 0326321

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

runtime/Stdlib_Symbol.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type t
22

33
@val external make: string => t = "Symbol"
4-
@val external getFor: string => t = "Symbol.for"
4+
@val external getFor: string => option<t> = "Symbol.for"
55
@val external keyFor: t => option<string> = "Symbol.keyFor"
66
@get
77
external description: t => option<string> = "description"

runtime/Stdlib_Symbol.resi

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Otherwise a new Symbol gets created and registered with key.
3232
## Examples
3333
3434
```rescript
35-
Symbol.getFor("foo")->assetEqual("foo")
35+
Symbol.getFor("sym1")->assetEqual(Symbol.getFor("sym1"))
3636
```
3737
*/
3838
@val
@@ -48,13 +48,11 @@ Retrieves a shared Symbol key from the global Symbol registry for the given Symb
4848
```rescript
4949
let globalSym = Symbol.getFor("sym1") // Global symbol
5050
51-
Console.log(Symbol.keyFor(globalSym))
52-
// Expected output: "sym1"
51+
Symbol.keyFor(globalSym)->assertEqual(Some("sym1"))
5352
5453
let localSym = Symbol.make("sym2") // Local symbol
5554
56-
Console.log(Symbol.keyFor(localSym))
57-
// Expected output: undefined
55+
Symbol.keyFor(localSym)->assertEqual(None)
5856
```
5957
*/
6058
@val

0 commit comments

Comments
 (0)