Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

TypeError: (0 , _rambdax.contains) is not a function #471

Closed CochiorasBogdan closed 5 years ago

CochiorasBogdan commented 5 years ago

Hello, so I am receiving the following error TypeError: (0 , _rambdax.contains) is not a function at @nozbe/watermelondb/Schema/index.js:48 where the verification (0, _invariant.default)((0, _rambdax.contains)(column.type, ['string', 'boolean', 'number']), "Invalid type ".concat(column.type, " for column ").concat(column.name, " (valid: string, boolean, number)")); is done, after further investigation I saw that the Rambdax module received a minor bump and in the previous commits it replaced the contains function with includes please check here the commit https://github.com/selfrefactor/rambdax/commit/789dad193d83fcc5aec5f95cd3b06f2e4eb35ba4 can the code be updated? I think the only change is to replace contains with includes, not sure since I didn't check for any other breaking change.

IronTony commented 5 years ago

Yes. The same happened to me today, when upgrading to RN v.0.60.5

curiousily commented 5 years ago

Same here. Use this as a temporary workaround in your yarn.lock file:

rambdax@^2.6.1:
  version "2.12.3"
  resolved "https://registry.yarnpkg.com/rambdax/-/rambdax-2.12.3.tgz#8be5c926f449cc6850352463682dae93322ed707"
  integrity sha512-4gbrTg8EDNYeLMN3edivQrSD6QzpDC7KWfhC0BwVaxZ60+5WCajTD9INVswsaWK1OLmOWguSQ47nMIoXZ1y5Tw==
bogdancochioras-clarisoft commented 5 years ago

For package-lock.json replace with:


"rambdax": {
      "version": "2.12.3",
      "resolved": "https://registry.npmjs.org/rambdax/-/rambdax-2.12.3.tgz",
      "integrity": "sha512-4gbrTg8EDNYeLMN3edivQrSD6QzpDC7KWfhC0BwVaxZ60+5WCajTD9INVswsaWK1OLmOWguSQ47nMIoXZ1y5Tw=="
    }
anfen commented 5 years ago

I must be missing something. I made the change to package-lock.json, ran npm install, uninstalled the react-native app from my device, but still this error occurs.

I have checked the versionn of Rambdax in my projects node_modules, and it is 2.12.3.

What have I missed?

UPDATE: I found the yarn.lock file, not that I use yarn, and made the recommended changes to that file as well... and then this Rambdax.contains issue seemed to disappear, until it came back after making changes to my source files.

Now the issue continues, even with the package-lock.json & yarn.lock files edited.