这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Jan 13, 2023. It is now read-only.
This repository was archived by the owner on Jan 13, 2023. It is now read-only.

shorthand ".." import on mobx-state-tree model definition file is causing cryptic error #382

@silencer07

Description

@silencer07

Steps to reproduce:

  1. create an app using cli
  2. ignite generate model foo
  3. try to include using this syntax
import {FooModel} from ".."

export const RootStoreModel = types.model("RootStore").props({
  user: types.maybeNull(FooModel)
})
  1. see this error on log
    Error: [mobx-state-tree] expected mobx-state-tree type as argument 1, got undefined instead

How i fixed it:

  1. created index.ts file in foo folder inside models
  2. add this code export * from "./foo"
  3. change the import to

import {FooModel} from "../foo"

I wasted 2 hours of debugging and pulling my hair. only to realize this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions