-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: prepare for TS defs generation [skip ci] #144
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.
Question: do we want to have custom types for orientation same as in list-mixin?
Yes, please. IMO this makes a huge difference in DX.
Also, not sure if nullish values should be accepted, since it has horizontal
by default, and in practice it's always oriented one way or the other.
I guess it's fine though, as the code seems to handle it, and I can't think of why it would cause any issues. Setting orientation=null
can be considered like removing the explicit configuration and resetting to the default.
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.
I agree with @pekam. There should be a type like:
export type SplitLayoutOrientation = 'horizontal' | 'vertical';
And orientation
property should have @type {!SplitLayoutOrientation}
Since it also has a default value I think it's good to enforce this type in TS defs (even if it doesn't break with null
or undefined
).
Also I'm not sure why _processChildren()
is protected. Seems like it could be @private
too.
When I run p3 conversion locally:
import missing? |
Thanks, I forgot about |
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.
Note, I couldn’t find a way to get correct types for IronResizableBehavior.
As discussed in Slack, if proper solution is not found, let's override notifyResize
(the only thing in IronResizableBehavior
that might be useful for the user of split-layout
) as a workaround to get it into the type definitions.
Otherwise LGTM.
I think we could maybe use addReferences instead of overriding a method just to get type defs for it. But I think we also had some Iron behaviours in other already merged TS defs PRs similarly without type info (though I'm not sure if those had any relevant things we'd want to have types for). |
@pekam added the method. |
From the user's perspective, bloating the API with all the things in So IMO the current approach might be the best approach for the goal of these typings; better DX. @Haprog do you approve? |
@pekam I agree. With |
Ok, I misunderstood then. In a generic case, where there may be any number of props and functions we want to pull from a behavior, this might be the better way to separate them from the code. For this case, either way is fine for me. |
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.
LGTM
Fixes #143
Note, I couldn’t find a way to get correct types for
IronResizableBehavior
.Tried
@implements {IronResizableBehavior}
but that didn’t help.So, generated TS definitions look like this:
Question: do we want to have custom types for
orientation
same as in list-mixin?