File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 11type 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
77external description : t => option <string > = "description"
Original file line number Diff line number Diff 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
4949let 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
5453let 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
You can’t perform that action at this time.
0 commit comments