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

recursive types broken #187

Closed
amir-arad opened this issue Jun 13, 2017 · 3 comments
Closed

recursive types broken #187

amir-arad opened this issue Jun 13, 2017 · 3 comments

Comments

@amir-arad
Copy link

this code:

const {types} = require("mobx-state-tree");
const MstNode = types.model("MstNode", {
	value: types.number,
	next: types.maybe(types.late(() => MstNode)),
});

throws ReferenceError: MstNode is not defined from

at Late.get [as subType] (.../mst-benchmark/node_modules/mobx-state-tree/lib/types/utility-types/late.js:35:38)
at Late.get [as flags] (.../mst-benchmark/node_modules/mobx-state-tree/lib/types/utility-types/late.js:27:24)

after upgrading to 0.7.1.

love your work!

@cpunion
Copy link
Contributor

cpunion commented Jun 13, 2017

@mattiamanzati
Copy link
Contributor

Uhm, yeah, seems to be due to https://github.com/mobxjs/mobx-state-tree/blob/master/src/types/complex-types/object.ts#L113-L117 checks in constructor :/ @mweststrate Do you think it's better to move modelConstructor initialization in first initialize call (and may break extend()) or introduce a flag to determine if type is an identifier?

@mattiamanzati
Copy link
Contributor

New idea: drop completely IdentifierProperty, perform the work on the Identifier type initialize. Will give it a shot later.

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

3 participants