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

no-array-callback-reference: Ignore mobx-state-tree usage #1455

Merged

Conversation

pustovalov
Copy link
Contributor

Hey,

I want to enable this rule in the project which uses MST

but at the moment this rule shows errors on default usage of this lib: https://mobx-state-tree.js.org/API/#map

WDYT about these changes?

@sindresorhus sindresorhus changed the title no-array-callback-reference: ignore MST usage no-array-callback-reference: Ignore MST usage Jul 28, 2021
@sindresorhus sindresorhus changed the title no-array-callback-reference: Ignore MST usage no-array-callback-reference: Ignore mobx-state-tree usage Jul 28, 2021
@sindresorhus
Copy link
Owner

Couldn't you just use this?

const EventsStore = types.model('EventsStore', {
	events: types.optional(types.map(type => Event(type)), {}),
})

@pustovalov
Copy link
Contributor Author

looks like I can't

Uncaught TypeError: type.getSubTypes is not a function mobx-state-tree.module.js:4787 
    at tryCollectModelTypes (mobx-state-tree.module.js:4787)
    at MapType.value (mobx-state-tree.module.js:4976)
    at new MapType (mobx-state-tree.module.js:4945)
    at Object.map (mobx-state-tree.module.js:5278)

@sindresorhus sindresorhus requested a review from fisker July 28, 2021 12:20
@sindresorhus sindresorhus merged commit 73c0dfd into sindresorhus:main Jul 28, 2021
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

Successfully merging this pull request may close these issues.

None yet

3 participants