Skip to content

Commit cf4577e

Browse files
committed
Add optional arg example.
1 parent b7e64b5 commit cf4577e

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

jscomp/gentype_tests/typescript-react-example/src/V4.bs.js

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let optionMap = (x, f) =>
2+
switch x {
3+
| None => None
4+
| Some(v) => Some(f(v))
5+
}
6+
7+
module Parens = {
8+
@react.component
9+
let make = (~id=?) => {
10+
<div id=?{id->optionMap(x => x)} />
11+
}
12+
}

0 commit comments

Comments
 (0)