Open TFuriosiITDM opened 1 year ago
I believe this is related to TypeScript 5, this is a new major version that has been released a couple months ago and I will need to check and adjust types for JustValidate
There is a general discussion of the topic here: https://github.com/microsoft/TypeScript/issues/52363
One of the Microsoft typescript contributors made this little tool that might help to see what the problem is: https://arethetypeswrong.github.io/?p=just-validate%404.3.0
Digging in the typescript thread I found a patch solution to the problem, using the patch-package npm package. You fix the problem by editing the problem package (in this case just-validate
) directly in your node-modules
. patch-package
can then diff the changes against the original package and apply a patch that should be robust for reinstalls.
These 4 steps removed the problem and gave me correct types for just-validate
:
Install patch-package
into the root of your project
npm i -D patch-package
Add this line to your package.json
's scripts
section
"scripts": {
"postinstall": "patch-package"
},
Navigate to node_modules/just-validate/package.json
and remove these lines:
"exports": {
".": {
"import": "./dist/just-validate.es.js",
"require": "./dist/just-validate.production.min.js"
}
},
Run this in the root of your project to create the patch:
npx patch-package just-validate --exclude "nothing"
(the --exclude "nothing"
makes sure patch-package
also takes changes in package.json
into account)
This creates a patches
directory in your project root and fixes the problem. At least on my machine.
Describe the bug I'm using just-validate inside a Vite React Typescript project. The library works well and the code compiles successfully but i see this annoying error message from ESLint:
Is there any way to fix it?
To Reproduce
Expected behavior No error or warnings.
My package.json