Skip to content

Commit a505761

Browse files
committed
extend examples
1 parent 91afcb8 commit a505761

File tree

2 files changed

+39
-15
lines changed

2 files changed

+39
-15
lines changed

jscomp/test/UntaggedVariants.js

Lines changed: 26 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jscomp/test/UntaggedVariants.res

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,24 @@ module PromiseSync = {
362362
}
363363

364364
module Arr = {
365-
@unboxed type arr = Array(array<string>) | String(string) | Promise(promise<string>)
365+
type record = {userName: string}
366+
367+
@unboxed
368+
type arr =
369+
| Array(array<string>)
370+
| String(string)
371+
| Promise(promise<string>)
372+
| Object(record)
373+
| @as("test") Test
374+
| @as(12) TestInt
366375

367376
let classify = async (a: arr) =>
368377
switch a {
369378
| Array(arr) => Js.log(arr->Belt.Array.joinWith("-"))
370379
| String(s) => Js.log(s)
371380
| Promise(p) => Js.log(await p)
381+
| Object({userName}) => Js.log(userName)
382+
| Test => Js.log("testing")
383+
| TestInt => Js.log(12)
372384
}
373385
}

0 commit comments

Comments
 (0)