Skip to content

Commit

Permalink
Support built-in dict type
Browse files Browse the repository at this point in the history
  • Loading branch information
DZakh committed Jan 30, 2024
1 parent b8cdee9 commit 8b80865
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/rescript-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ let schema = S.tuple3(S.string, S.int, S.bool)

### **`dict`**

`S.t<'value> => S.t<Dict.t<'value>>`
`S.t<'value> => S.t<dict<'value>>`

```rescript
let schema = S.dict(S.string)
Expand Down
1 change: 1 addition & 0 deletions packages/rescript-schema-ppx/src/ppx/Structure.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let rec generateConstrSchemaExpression {Location.txt = identifier; loc}
[%e generateCoreTypeSchemaExpression item_type]]
| Lident "null", [item_type] ->
[%expr S.null [%e generateCoreTypeSchemaExpression item_type]]
| Lident "dict", [item_type]
| Ldot (Ldot (Lident "Js", "Dict"), "t"), [item_type]
| Ldot (Lident "Dict", "t"), [item_type] ->
[%expr S.dict [%e generateCoreTypeSchemaExpression item_type]]
Expand Down

0 comments on commit 8b80865

Please sign in to comment.