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

new instance -> TypeError: _dec is not a function #46

Open
mi4uu opened this issue Mar 27, 2019 · 3 comments
Open

new instance -> TypeError: _dec is not a function #46

mi4uu opened this issue Mar 27, 2019 · 3 comments

Comments

@mi4uu
Copy link

mi4uu commented Mar 27, 2019

hi,
I use global store as described in https://mobx.js.org/best/store.html#combining-multiple-stores
so I'm decorating class with @RemoteDev(/{ config }/) like this:

import ProjectsStore from './projects'
import OperatorsStore from './operators'
import StepsStore from './steps'
import remotedev from 'mobx-remotedev'
@remotedev(/*{ config }*/)
export class RootStore {
    constructor() {
      this.projectsStore = new ProjectsStore(this)
      this.operatorsStore = new OperatorsStore(this)
      this.stepsStore = new StepsStore(this)
    }
  }

export default new RootStore()

and creating instance of it that is provided to Provider which lead to error:

TypeError: _dec is not a function
Module../src/store/rootStore.js
src/store/rootStore.js:6
  3 | import StepsStore from './steps'
  4 | import remotedev from 'mobx-remotedev'
  5 | @remotedev(/*{ config }*/)
> 6 | export class RootStore {
  7 |     constructor() {
  8 |       this.projectsStore = new ProjectsStore(this)
  9 |       this.operatorsStore = new OperatorsStore(this)

working application (without remotedev) is here https://github.com/lipt0n/state-POC/tree/master/mobxtest

@mi4uu mi4uu changed the title decorate instance new instance -> TypeError: _dec is not a function Mar 27, 2019
@olee
Copy link

olee commented Apr 24, 2019

I'm getting the same error - using mobx@4

@mleger45
Copy link

Hi, I am getting the same error

@dericcain
Copy link

dericcain commented Jul 23, 2019

It looks like you should not invoke the decorator as a function (notice the lack of () in @remotedev):

@remotedev
class SomeStore {}

That at least gets rid of the error for me.

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

4 participants