Issues Upgrading to v8.0.0
See original GitHub issueI’m attempting to update mobx-rest from v7.1.1 to v8.0.0 in a typescript project. Unfortunately, the upgrade has introduced some breaking changes. Namely, the Model / Collection inheritance structure breaks down. Within the project, we extend the Model / Collection classes with our own base classes, adding some custom logic / overrides. Say we have a Posts table in our db that we are interacting with. Our FE class hierarchy would look something like this:
import { Model, Collection } from 'mobx-rest'
class ModelBase extends Model {}
class CollectionBase extends Collection {}
class PostModel extends ModelBase {}
class PostCollection extends CollectionBase {}
This works as expected with v7.1.1. However, with v8.0.0 I’m seeing a bunch of TS2339: Property does not exist on type
typescript errors. For example, TS2339: Property 'withRequest' does not exist on type 'PostModel'
. Digging into node_modules/mobx-rest
for v8.0.0, it looks like the type declaration files are no longer included in the npm package (I’ve confirmed that they are still present for v7.1.1). What is the reason for this change?
Also, when I was digging through the source code trying to find an explanation for the breakage, I noticed that package.json
still has the version at 7.1.1 with no mention of a v8.0.0 release anywhere. I’m assuming that PR merge #96 (supporting mobx@6) bumped mobx-rest to v8.0.0, but it’s a little concerning that this is not transparent within the repo. It would be helpful to include v8.0.0 in the change log and keep package.json
consistent with the latest release.
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:15 (5 by maintainers)
Top GitHub Comments
@masylum Unfortunately, I don’t have much helpful input. I have the upgrade living on a branch that I haven’t looked at since my last comment on this thread, so I can’t say that I’ve really dug into it. As far as I remember, we experienced some friction related to a different implementation of the Model / Collection
toJS
methods. But everything else went pretty smoothly. Our inheritance structure is quite simple. We have custom ModelBase < Model, CollectionBase < Collection base classes that implement some overrides but these all fall within the scope of the acceptable overrides discussed in the documentation you linked. Sorry to not be of more help amigo.Can verify that the fix PR solved the issue. Thanks again!