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

allow wildcard properties in type statement #235

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rbellens
Copy link

Currently it is not allowed to have both wildcard properties and fields. Therefore, it is not possible to define types that allow properties other than the ones defined in the type statement. Only workaround is to not use type statements and manually define the validate rules, which is very cumbersome. See also issues #212 and #213 .

This pull request allows a single wildcard property inside a type definition and when present disables the generation of the default validation rule that does not allow any field other than the ones defined.

return v[0] === '$';
});

if (hasProps && !hasWildProps ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you format the spacing here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted the spacing

num: Number;
str: String;
any: Any;
$extras: Any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use $XXX with a type other than Any?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added example with String type

@rockwotj rockwotj self-assigned this Dec 14, 2018
@dengjeffrey
Copy link

@rbellens Are you still maintaining this PR? If not I might have some free time to continue where you left off

@rbellens
Copy link
Author

@dengjeffrey feel free to do so

@iamareebjamal
Copy link

Can we have this feature soon, please :)

@debkanchan
Copy link

Hey can we revive this PR?

@acorn1010
Copy link

acorn1010 commented Jun 10, 2020

The continuous-integration/travis-ci/pr failure from the integration check isn't related to this PR--it's an issue with [email protected]'s dependency on graceful-fs.

Here's a detailed explanation on StackOverflow with some workarounds: https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node.

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.

7 participants