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

schema[method] is not a function #4

Open
alligatortower opened this issue Jul 11, 2020 · 3 comments
Open

schema[method] is not a function #4

alligatortower opened this issue Jul 11, 2020 · 3 comments
Labels
invalid This doesn't seem right

Comments

@alligatortower
Copy link

https://codesandbox.io/s/epic-ives-ymo6w?file=/src/index.js

I'm really hoping I'm not missing something simple. I could have sworn I got a simple example working after your most recent push (8727490), but now I can't get anything involving custom methods to work. Any schema with a custom method returns this error. I've inspected the yup module and the method is there, as far as I can tell.

@spaceemotion spaceemotion added question Further information is requested bug Something isn't working and removed question Further information is requested labels Jul 12, 2020
@spaceemotion
Copy link
Contributor

spaceemotion commented Jul 13, 2020

Confirmed with yup ^0.29. This error does not appear when you use 0.28.x: https://codesandbox.io/s/naughty-ganguly-mszik?file=/src/index.js.

Edit: can't confirm with the unit tests though. Only appears with the production build so far?

@spaceemotion
Copy link
Contributor

Alright, so this took a while:

  • When I install the yup-ast package via NPM, it breaks because yup-ast has the yup dependency installed inside of its own folder.
  • When I use yarn instead; the package gets hoisted up and both use the same version.
  • If they use different versions, the yup instance never gets the custom method, so you will have to provide your "custom" instance via the second argument (like so: transformAll([...], yup) to fix the issue.

Right now I don't know why npm does not link those two together, but, hey. at least there's a workaround?

@spaceemotion spaceemotion added invalid This doesn't seem right and removed bug Something isn't working labels Jul 13, 2020
@alligatortower
Copy link
Author

Interesting. Yeah that workaround solves any issue. Another reason to just remove npm from my life entirely I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants