Skip to content

Conversation

@danez
Copy link
Collaborator

@danez danez commented Aug 24, 2017

Creates a new util to extract keys from Object.keys() and ObjectExpressions when used inside of oneOf()
It also follows spreads and tries to resolve them. Currently it bails out if either a Property is computed and the computed key is not a Literal or if a spread cannot be resolved.

Getters will be handled the same as normal properties, but setters will be ignored. Not sure if this makes 100% sense, but this can be easily changed.

This fixes #153.

As a follow up the same can be done easily for Object.values.

!! When this gets merged to v3, SpreadProperty needs to be replaced with SpreadElement !!

Creates a new util to extract keys from ObjectExpressions.
This does not ignore setters, but deduplicate the resolved entries and
makes them unique.
@danez danez merged commit 55bbefe into reactjs:master Sep 5, 2017
@danez danez deleted the object-keys branch September 5, 2017 11:59
@romanlex
Copy link

Hello, anybody can merge this pr to v3-dev branch?

@stepancar
Copy link

@danez

@stonebk
Copy link

stonebk commented Oct 16, 2018

It would be great if this could be done for Object.values() as well as @danez mentioned.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support Object.keys within oneOf

4 participants