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

expected.flat is not a function #3

Closed
wagerfield opened this issue Jan 26, 2019 · 2 comments
Closed

expected.flat is not a function #3

wagerfield opened this issue Jan 26, 2019 · 2 comments

Comments

@wagerfield
Copy link

@wagerfield wagerfield commented Jan 26, 2019

Further to my previous issue (#2) after installing @znck/prop-types as a dev dependency, I am now seeing the error:

expected.flat is not a function

Stack trace:

static collectionOf(type, expected) {
  const prop = this.create(type);
  const types = expected.flat().map(normalizeType);

  prop.validator = value => Object.values(value).every(item => types.some(type => runValidation(type, item)));

  return prop;
}

Digging into this, I can see that collectionOf is called internally by arrayOf and objectOf (within the @znck/prop-types package) and that expected is an Array. This error is therefore coming from the fact that the Array instance in Node 10.15.0 doesn't have the flat method on it.

I am using Nuxt, so this error is coming from the server (with a very recent version of Nod) and not the client.

@znck

This comment has been minimized.

Copy link
Owner

@znck znck commented Jan 26, 2019

Thanks for giving this detailed account. I'm fixing it ASAP.

znck added a commit that referenced this issue Jan 26, 2019
fixes #2 #3
@znck znck closed this Jan 26, 2019
@znck

This comment has been minimized.

Copy link
Owner

@znck znck commented Jan 26, 2019

It's fixed and released (https://github.com/znck/lazy-hydration/runs/55170555)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.