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

Define properties default value as null or undefined #154

Merged
merged 2 commits into from
Dec 11, 2019

Conversation

cherifGsoul
Copy link
Member

@cherifGsoul cherifGsoul commented Dec 9, 2019

This fix adds the ability to define properties with null or undefined default value:

class Foo extends mixinObject() {
    static get props() {
          return {
	       nullProp: { default: null },
	       undefinedProp: { default: undefined }
	 };
    }
}

var foo = new Foo();
foo.nullProp; // -> null
foo.undefinedProp; // -> undefined

Closes #148

Copy link
Contributor

@phillipskevin phillipskevin left a comment

Choose a reason for hiding this comment

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

We also want to support

nullProp: null,
undefinedProp: undefined

which still throws with your change.

@cherifGsoul cherifGsoul merged commit 772906a into master Dec 11, 2019
@cherifGsoul cherifGsoul deleted the allow-null-undefined-default branch December 11, 2019 18:31
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.

Cannot default property to null / undefined without setting type
2 participants