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

Nested proptypes in FlowType causes RangeError: Maximum call stack size exceeded #913

Closed
willlma opened this issue Oct 16, 2016 · 5 comments

Comments

@willlma
Copy link

willlma commented Oct 16, 2016

I'm guessing this is causing an infinite loop. Not sure is this belongs here or in the Flow repo (or if I'm just doing things wrong). I've got a nested array that looks like this:

type Note = {text: string, children?: Note[]}
type Props = {
  notes: Note[]
};

Which is throwing RangeError: Maximum call stack size exceeded

Here's the full stack (absolute path to project abbreviated as ~):

    at getKeyValue (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:289:25)
    at iterateProperties (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:308:21)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:441:11)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:433:20)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:472:28)
    at ~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:442:54
    at iterateProperties (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:311:11)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:441:11)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:433:20)
    at buildTypeAnnotationDeclarationTypes (~/node_modules/eslint-plugin-react/lib/rules/prop-types.js:472:28)

I've stuck with a simple type Props = { notes: Object[] } for now

@ljharb
Copy link
Member

ljharb commented Mar 31, 2017

See also #1032.

phpnode added a commit to codemix/eslint-plugin-react that referenced this issue Apr 3, 2017
@ljharb ljharb added the flow label Jun 13, 2017
@jetpacmonkey
Copy link
Contributor

Is there any good workaround here? I'm still seeing this issue.

@ljharb
Copy link
Member

ljharb commented Jan 12, 2018

#1138 / #1377 / #1412 should help, but this might still require further fixes.

@jetpacmonkey
Copy link
Contributor

It looks like #1138 did address this issue, but it was closed in favor of #1377, which, as far as I can tell, does not.

@jetpacmonkey
Copy link
Contributor

I opened #1653 based off of the commit in #1138 that fixed recursive proptype definitions.

@ljharb ljharb closed this as completed in 614d3bd Jan 27, 2018
ljharb added a commit that referenced this issue Jan 27, 2018
Support recursive type annotations, fixes #913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants