Skip to content

Commit 094f683

Browse files
committed
add Jsx module for new transform
1 parent d2770b8 commit 094f683

File tree

3 files changed

+2566
-0
lines changed

3 files changed

+2566
-0
lines changed

src/Jsx.res

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
type element = React.element
2+
3+
@val external null: element = "null"
4+
5+
external float: float => element = "%identity"
6+
external int: int => element = "%identity"
7+
external string: string => element = "%identity"
8+
9+
external array: array<element> => element = "%identity"
10+
11+
type componentLike<'props, 'return> = React.componentLike<'props, 'return>
12+
13+
type component<'props> = React.component<'props>
14+
15+
/* this function exists to prepare for making `component` abstract */
16+
external component: componentLike<'props, element> => component<'props> = "%identity"
17+
18+
@module("react/jsx-runtime")
19+
external jsxKeyed: (component<'props>, 'props, string) => element = "jsx"
20+
21+
@module("react/jsx-runtime")
22+
external jsx: (component<'props>, 'props) => element = "jsx"
23+
24+
@module("react/jsx-runtime")
25+
external jsxs: (component<'props>, 'props) => element = "jsxs"
26+
27+
@module("react/jsx-runtime")
28+
external jsxsKeyed: (component<'props>, 'props, string) => element = "jsxs"
29+
30+
external stringToComponent: string => component<JsxDOM.domProps> = "%identity"

0 commit comments

Comments
 (0)