-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update Transition type definition #157
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme additions are great. Could you take another look into the definition though - there seems to be a mistake as children/render can't take boolean types, they can take a ternary which yields a function or undefined.
src/Transition.js
Outdated
| children: PropTypes.oneOfType([ | ||
| PropTypes.arrayOf(PropTypes.func), | ||
| PropTypes.func, | ||
| PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lasseborly {visible && fn} isn't a boolean, though. It either results in a function of undefined.
src/Transition.js
Outdated
| render: PropTypes.oneOfType([ | ||
| PropTypes.arrayOf(PropTypes.func), | ||
| PropTypes.func, | ||
| PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here.
|
@drcmda I see your point. Will correct. |
|
@drcmda corrected! |
| {toggle ? ComponentA : ComponentB} | ||
| {toggle | ||
| ? styles => <ComponentA style={styles} /> | ||
| : styles => <ComponentB style={styles} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will definitely clear up some confusion 👍
|
@drcmda is there anything else I can do to make this go through? |
|
@lasseborly i'll merge and release today. wasn't with a computer over the last week, we made a small trip to rome :-) |
|
Sounds lovely @drcmda ! |
|
Just went through, boolean still seems to be part of children and render children?:
| SpringRendererFunc<S, DS>
| Array<SpringRendererFunc<S, DS>>
| boolean
render?:
| SpringRendererFunc<S, DS>
| Array<SpringRendererFunc<S, DS>>
| booleanCould i see a snippet of code that depends on your fork? Because it seems strange, children/render shouldn't take booleans, only functions and ternaries that yield functions, or undefined. |
|
@drcmda so when we do the single component transition TS interprets that as children/render being a boolean if I made a codesandbox so you can see the problem for yourself. |
|
I can see the argument for not having the |
|
Just checking if it's correct - i have yet to dig into TS. If it helps TS knowing undefined i guess it's fine. I'll run some errands and release later this day. |
Update Transition type definition
This PR reflects some of the thought put out in #26 (comment).
From reading some of the recent PR's I can see that having a literal boolean type on
Transitionhas been discussed in #84 but never seemed to have gotten implemented.The TS compiler throws an error if a literal boolean false type is being substituted for this PR's basic boolean type. A simple type discrepancy. Therefore
booleanis used instead.I'll modify as needed.
Thanks for a great lib @drcmda 👍