Skip to content

Commit e7ea886

Browse files
Fix mantine compat (#93)
* Bump pnpm * Add mantine to dev deps * Add type-test for mantine button * Make Mantine edge-case partially work * Add expect type checks * Try to fix other operators * Add notice to the docs * bump ts and update tests * Remove unused import * Update variant tests * Add another example
1 parent 9226a7d commit e7ea886

File tree

8 files changed

+6816
-4848
lines changed

8 files changed

+6816
-4848
lines changed

docs/pages/docs/reflect.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,23 @@ In most cases your callbacks will be synchronous and you will not need to do any
115115
#### Special case: Asynchronous callbacks
116116

117117
Asynchronous callbacks are also allowed, but those should follow the rules of [Imperative Effect calls with Scope](https://effector.dev/en/api/effector/scope/) to be compatible.
118+
119+
## TypeScript and Polymorphic Types Caveat
120+
121+
Generally, reflect handles polymorphic props well.
122+
However, in some implementations, such as [Mantine UI](https://mantine.dev/guides/polymorphic/), it may not work as expected.
123+
124+
In such cases, it is recommended to explicitly narrow the component type. For example:
125+
126+
```ts
127+
const ReflectedMantineButton = reflect({
128+
view: MantineButton<'button'>, // <- notice explicit component type in the "<...>" brackets
129+
bind: {
130+
children: 'foo',
131+
onClick: (e) => {
132+
clicked(e.clientX);
133+
},
134+
},
135+
});
136+
```
137+

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"publishConfig": {
1212
"access": "public"
1313
},
14-
"packageManager": "pnpm@7.27.0",
14+
"packageManager": "pnpm@10.6.5",
1515
"exports": {
1616
".": {
1717
"types": "./index.d.ts",
@@ -61,6 +61,7 @@
6161
"@babel/preset-env": "^7.20.2",
6262
"@babel/preset-react": "^7.18.6",
6363
"@babel/preset-typescript": "^7.21.0",
64+
"@mantine/core": "^7.17.2",
6465
"@rollup/plugin-babel": "^6.0.3",
6566
"@rollup/plugin-commonjs": "^24.0.1",
6667
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -91,7 +92,7 @@
9192
"rollup-plugin-typescript2": "^0.34.1",
9293
"svelte": "^3.55.1",
9394
"tsd": "^0.19.1",
94-
"typescript": "^5.3.3",
95+
"typescript": "^5.8.2",
9596
"uglify-js": "^3.17.4",
9697
"vite-tsconfig-paths": "^4.2.2",
9798
"vitest": "^1.0.4",

0 commit comments

Comments
 (0)