From 432f4439f7b7362aa8e3c70a5316529ae3594865 Mon Sep 17 00:00:00 2001 From: Viki Date: Fri, 15 Sep 2023 17:34:05 +0800 Subject: [PATCH] docs: add FAQ about readonly hack --- README.md | 15 ++++++++++++++- packages/reactive/package.json | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bfdc87a..409ee6b 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,19 @@ export default function Foo() { } ``` +## FAQ + +### TS type error, `readonly` type can not be assigned to mutable type + +This error commonly occurs when using [shineout](https://github.com/sheinsight/shineout), [antd](https://github.com/ant-design/ant-design) or other UI component libraries. + +To resolve this issue, add following code to your entry file, and you can head to [PR#8](https://github.com/sheinsight/reactive/pull/8) for more details. + +```ts +// add this line to your entry file, like `index.tsx`, `global.d.ts` or ect. +import "@shined/reactive/hack-remove-readonly"; +``` + ## Examples - [base-example](https://stackblitz.com/edit/vitejs-vite-zli31f?file=src%2Fmain.tsx) @@ -138,4 +151,4 @@ export default function Foo() { ## License -- [MIT](LICENSE) +- [MIT](./LICENSE) diff --git a/packages/reactive/package.json b/packages/reactive/package.json index 6f41cee..10a976a 100644 --- a/packages/reactive/package.json +++ b/packages/reactive/package.json @@ -13,7 +13,8 @@ "test:cov": "vitest run --coverage" }, "files": [ - "dist" + "./dist", + "./hack-remove-readonly.d.ts" ], "exports": { ".": {