You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/docs/gentype/latest/supported-types.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,7 +88,7 @@ The `@genType.as` annotation can be used to modify the name emitted for a varian
88
88
Boolean/integer/float constants can be expressed as ``` | [@genType.as true] True ``` and ``` | [@genType.as 20] Twenty ``` and ``` | [@genType.as 0.5] Half ```. Similarly for polymorphic variants.
89
89
The `@genType.as` annotation can also be used on variants with payloads to determine what appears in `{ tag: ... }`.
90
90
91
-
For more examples, see [Variants.res](examples/typescript-react-example/src/Variants.res) and [VariantsWithPayload.res](examples/typescript-react-example/src/VariantsWithPayload.res).
91
+
For more examples, see [Variants.res](https://github.com/reason-association/genType/tree/master/examples/typescript-react-example/src/Variants.res) and [VariantsWithPayload.res](https://github.com/reason-association/genType/tree/master/examples/typescript-react-example/src/VariantsWithPayload.res).
92
92
93
93
**NOTE:** When exporting/importing values that have polymorphic variant type, you have to use type annotations, and cannot rely on type inference. So instead of ```let monday = `Monday```, use ```let monday : days = `Monday```. The former does not work, as the type checker infers a type without annotations.
94
94
@@ -97,7 +97,7 @@ For more examples, see [Variants.res](examples/typescript-react-example/src/Vari
97
97
Arrays with elements of ReScript type `t` are exported to JS arrays with elements of the corresponding JS type. If a conversion is required, a copy of the array is performed.
98
98
99
99
Immutable arrays are supported with the additional ReScript library
100
-
[ImmutableArray.res/.resi](examples/typescript-react-example/src/ImmutableArray.resi), which currently needs to be added to your project.
100
+
[ImmutableArray.res/.resi](https://github.com/reason-association/genType/tree/master/examples/typescript-react-example/src/ImmutableArray.resi), which currently needs to be added to your project.
101
101
The type `ImmutableArray.t(+'a)` is covariant, and is mapped to readonly array types in TS/Flow. As opposed to TS/Flow, `ImmutableArray.t` does not allow casting in either direction with normal arrays. Instead, a copy must be performed using `fromArray` and `toArray`.
102
102
103
103
## Functions and Function Components
@@ -146,13 +146,13 @@ It's possible to import an existing TS/Flow type as an opaque type in ReScript.
146
146
```
147
147
148
148
defines a type which maps to `weekday` in `SomeFlowTypes.js`.
149
-
See for example [Types.re](examples/flow-react-example/src/Types.re) and [SomeFlowTypes.js](examples/flow-react-example/src/SomeFlowTypes.js).
149
+
See for example [Types.re](https://github.com/reason-association/genType/tree/master/examples/flow-react-example/src/Types.re) and [SomeFlowTypes.js](https://github.com/reason-association/genType/tree/master/examples/flow-react-example/src/SomeFlowTypes.js).
150
150
151
151
## Recursive Types
152
152
153
153
Recursive types which do not require a conversion are fully supported.
154
154
If a recursive type requires a conversion, only a shallow conversion is performed, and a warning comment is included in the output. (The alternative would be to perform an expensive conversion down a data structure of arbitrary size).
155
-
See for example [Types.res](examples/typescript-react-example/src/nested/Types.res).
155
+
See for example [Types.res](https://github.com/reason-association/genType/tree/master/examples/typescript-react-example/src/nested/Types.res).
0 commit comments