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

Can I not use propTypes? #56

Closed
amrdraz opened this issue Oct 25, 2017 · 8 comments
Closed

Can I not use propTypes? #56

amrdraz opened this issue Oct 25, 2017 · 8 comments

Comments

@amrdraz
Copy link
Contributor

amrdraz commented Oct 25, 2017

Types can be enforced by a type system like Flow or TypeScript, and there's no real benefit (that I am aware of) to be gained in production from including them.

can they be made optional? that way they can be stripped using a babel codemode for example when building for production.

@mariusandra
Copy link
Member

Hi, I'll release 0.27 some time tomorrow and it will be possible to omit proptypes there.

@amrdraz
Copy link
Contributor Author

amrdraz commented Oct 26, 2017

Awesome, can't wait 😄

@mariusandra
Copy link
Member

It's out! :)

Closing the issue for now. If there's anything broken with it, feel free to reopen!

@dingbat
Copy link

dingbat commented Oct 3, 2018

Hi! Glad this went in, but FYI I think omitting proptypes might be causing an issue with @connect here:

if (propType) {
propTypes[to] = propType
} else if (from !== '*') {
console.error(`[KEA-LOGIC] prop type for "${from}" missing for logic:`, logic)
console.trace()
}

Seems harmless but it'd be nice to silence the console.errors if possible.

Thanks!

Edit: Also happy to submit a PR if you had an idea on a particular direction for this one, but I wasn't sure since omitting proptypes is not really an explicit "mode" that we can detect.

@scottybollinger
Copy link

@mariusandra will the comment above be addressed in 1.0? We have to use a different library for global state because we use TypeScript and got the above error when trying to use connect to connect multiple logic files.

Thanks!

@mariusandra
Copy link
Member

Hi @scottybollinger , I can't answer that now. However I'll leave the issue open and definitely revisit/clarify this before 1.0 is out. So hopefully yes, it will be fixed.

@mariusandra mariusandra reopened this May 30, 2019
@scottybollinger
Copy link

Thanks 🙏

@mariusandra
Copy link
Member

Prop types are totally optional in kea 1.0

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

No branches or pull requests

4 participants