|
1 | 1 | module Bar = { |
2 | | - @obj external makeProps: (~a: 'a, ~b: 'b, ~key: string=?, unit) => {"a": 'a, "b": 'b} = "" |
3 | | - let make = |
4 | | - (@warning("-16") ~a, @warning("-16") ~b, _) => { |
5 | | - Js.log("This function should be named `InnerModule.react$Bar`") |
6 | | - ReactDOMRe.createDOMElementVariadic("div", []) |
7 | | - } |
| 2 | + type props<'a, 'b> = { |
| 3 | + @optional key: string, |
| 4 | + @optional ref: React.ref<Js.Nullable.t<Dom.element>>, |
| 5 | + a: 'a, |
| 6 | + b: 'b, |
| 7 | + } |
| 8 | + let make = ({a, b, ref}: props<'a, 'b>) => { |
| 9 | + let _ = ref |
| 10 | + |
| 11 | + Js.log("This function should be named `InnerModule.react$Bar`") |
| 12 | + ReactDOMRe.createDOMElementVariadic("div", []) |
| 13 | + } |
8 | 14 | let make = { |
9 | | - let \"InnerModule$Bar" = (\"Props": {"a": 'a, "b": 'b}) => |
10 | | - make(~b=\"Props"["b"], ~a=\"Props"["a"], ()) |
| 15 | + let \"InnerModule$Bar" = (props: props<_>) => make(props) |
11 | 16 | \"InnerModule$Bar" |
12 | 17 | } |
13 | | - @obj external componentProps: (~a: 'a, ~b: 'b, ~key: string=?, unit) => {"a": 'a, "b": 'b} = "" |
| 18 | + type props<'a, 'b> = { |
| 19 | + @optional key: string, |
| 20 | + @optional ref: React.ref<Js.Nullable.t<Dom.element>>, |
| 21 | + a: 'a, |
| 22 | + b: 'b, |
| 23 | + } |
| 24 | + |
| 25 | + let component = ({a, b, ref}: props<'a, 'b>) => { |
| 26 | + let _ = ref |
14 | 27 |
|
15 | | - let component = |
16 | | - (@warning("-16") ~a, @warning("-16") ~b, _) => { |
17 | | - Js.log("This function should be named `InnerModule.react$Bar$component`") |
18 | | - ReactDOMRe.createDOMElementVariadic("div", []) |
19 | | - } |
| 28 | + Js.log("This function should be named `InnerModule.react$Bar$component`") |
| 29 | + ReactDOMRe.createDOMElementVariadic("div", []) |
| 30 | + } |
20 | 31 | let component = { |
21 | | - let \"InnerModule$Bar$component" = (\"Props": {"a": 'a, "b": 'b}) => |
22 | | - component(~b=\"Props"["b"], ~a=\"Props"["a"], ()) |
| 32 | + let \"InnerModule$Bar$component" = (props: props<_>) => make(props) |
23 | 33 | \"InnerModule$Bar$component" |
24 | 34 | } |
25 | 35 | } |
0 commit comments