Skip to content

Commit 583d4ba

Browse files
Merge pull request #180 from cca-io/fix-int-enums
Fix int enums
2 parents c3b0bde + 22fc36b commit 583d4ba

File tree

10 files changed

+15
-78
lines changed

10 files changed

+15
-78
lines changed

documentation/docs/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ title: Changelog
1414
(_Tags are copied from
1515
[babel](https://github.com/babel/babel/blob/master/CHANGELOG.md)_)
1616

17+
## 3.0.2
18+
19+
- :bug: Fixed the binding generator's handling of `int` enums.
20+
1721
## 3.0.1
1822

1923
- :house: Fixed outdated peer dependencies.

documentation/docs/project-structure/union-values.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,8 @@ type variant = [#elevation | #outlined]
4545

4646
## Numeric unions
4747

48-
A union consisting of only numbers will utilize the
49-
[[@int]](https://rescript-lang.org/docs/manual/latest/bind-to-js-function#constrain-arguments-better)
50-
directive. Therefore, numerical unions will accept a form of polymorphic variant
51-
as well.
48+
Numeric unions now work the same way as string only unions now and don't utilize
49+
the `@int` directive anymore.
5250

5351
These don't happen often - currently the only place where this applies is in the
5452
`Mui.Grid.res` component.

examples/src/examples/ExampleSlider.bs.js

+1-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/src/examples/ExampleStylingTailwind.bs.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/src/labExamples/ExampleToggleButton.bs.js

+1-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/rescript-material-ui-lab/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rescript-material-ui-lab",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "This library provides ReScript bindings for material-ui-lab.",
55
"keywords": [
66
"rescript",

public/rescript-material-ui-ppx/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rescript-material-ui-ppx",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"repository": "https://github.com/cca-io/rescript-material-ui",
55
"private": false,
66
"homepage": "https://rescript-material-ui.cca.io/",

public/rescript-material-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rescript-material-ui",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "This library provides ReScript bindings for material-ui.",
55
"keywords": [
66
"rescript",

public/rescript-material-ui/src/Grid.res

+1-14
Original file line numberDiff line numberDiff line change
@@ -349,20 +349,7 @@ external make: (
349349
~lg: Lg.t=?,
350350
~md: Md.t=?,
351351
~sm: Sm.t=?,
352-
~spacing: @int
353-
[
354-
| @as(0) #0
355-
| @as(1) #1
356-
| @as(2) #2
357-
| @as(3) #3
358-
| @as(4) #4
359-
| @as(5) #5
360-
| @as(6) #6
361-
| @as(7) #7
362-
| @as(8) #8
363-
| @as(9) #9
364-
| @as(10) #10
365-
]=?,
352+
~spacing: [#0 | #1 | #2 | #3 | #4 | #5 | #6 | #7 | #8 | #9 | #10]=?,
366353
~wrap: wrap=?,
367354
~xl: Xl.t=?,
368355
~xs: Xs.t=?,

tools/binding-generator/src/classes/property-parser/_enum.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ const factory = (propertyType: PropType$Enum) => {
125125
.map((name, i) => `#${name}`)
126126
.join(' | ')}];
127127
`;
128-
this._reasonType = `@int [${enumValuesReason
129-
.map((name, i) => `@as(${this._enumValues[i]}) #${name}`)
128+
this._reasonType = `[${enumValuesReason
129+
.map((name) => `#${name}`)
130130
.join(' | ')}]`;
131131
break;
132132
}

0 commit comments

Comments
 (0)