Skip to content
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

Typescript issues #93

Closed
avlonder opened this issue Feb 11, 2021 · 2 comments
Closed

Typescript issues #93

avlonder opened this issue Feb 11, 2021 · 2 comments

Comments

@avlonder
Copy link

avlonder commented Feb 11, 2021

Using the decorate function of MobX5, if I cannot use persist with one of the three optional arguments (object, list, map), without TypeScript throwing an "No overload matches this call".

Moreover, you can feed whatever string you like to persist without getting any TypeScript error.

I had a short look at the code, but I don't see how to patch it.

@avlonder
Copy link
Author

The error is gone if I set strictFunctionTypes to false in tsconfig.json. Still no clue how to apply a real fix.

@avlonder
Copy link
Author

Ok, I found the solution: in the type declaration of persist, you should change key: string to key: string | symbol.

Since this library has not been maintained for years, this is a consequence of an old issue in MobX: mobxjs/mobx#1713.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant