Skip to content

Fix mantine compat #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/pages/docs/reflect.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,23 @@ In most cases your callbacks will be synchronous and you will not need to do any
#### Special case: Asynchronous callbacks

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.

## TypeScript and Polymorphic Types Caveat

Generally, reflect handles polymorphic props well.
However, in some implementations, such as [Mantine UI](https://mantine.dev/guides/polymorphic/), it may not work as expected.

In such cases, it is recommended to explicitly narrow the component type. For example:

```ts
const ReflectedMantineButton = reflect({
view: MantineButton<'button'>, // <- notice explicit component type in the "<...>" brackets
bind: {
children: 'foo',
onClick: (e) => {
clicked(e.clientX);
},
},
});
```

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"publishConfig": {
"access": "public"
},
"packageManager": "pnpm@7.27.0",
"packageManager": "pnpm@10.6.5",
"exports": {
".": {
"types": "./index.d.ts",
Expand Down Expand Up @@ -61,6 +61,7 @@
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0",
"@mantine/core": "^7.17.2",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
Expand Down Expand Up @@ -91,7 +92,7 @@
"rollup-plugin-typescript2": "^0.34.1",
"svelte": "^3.55.1",
"tsd": "^0.19.1",
"typescript": "^5.3.3",
"typescript": "^5.8.2",
"uglify-js": "^3.17.4",
"vite-tsconfig-paths": "^4.2.2",
"vitest": "^1.0.4",
Expand Down
Loading
Loading