-
Notifications
You must be signed in to change notification settings - Fork 840
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
converts ComboBox family of components to TypeScript #2838
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
7327b28
to
e3cac5c
Compare
src/components/combo_box/index.ts
Outdated
export * from './combo_box_input'; | ||
export * from './combo_box_options_list'; | ||
|
||
export type EuiComboBoxOptionOption< |
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.
Please suggest a name, haha, all the good ones seem to be taken. I left it as OptionOption
just so that I could keep moving, unblocked by the need for a name.
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'll think on it. OptionOption
is fine for the time being.
@chandlerprall @thompsongl I sat down with this again. Made some good progress, but I still have something of a sticky-web to keep unweaving with refs. I'm definitely not ready for a full review yet (I have some I haven't done an extensive git-blame but it appears that, in the context of being a prop, export interface EuiComboBoxSingleSelectionShape {
asPlainText?: boolean;
} Was added after the singleSelection prop was just a simple boolean. There are places in the code that assume that it's one or the other, for example: here's one that seems to assume it'll be an object, always. and here's one that seems to assume it'll be a boolean, always. I tried to massage things into place, but I think I'm uncomfortable with the "level" of changes that I'd have to do in the context of a PR like this, which, in my mind, should make as few logical changes as possible. Your input is appreciated. |
@dimitropoulos Thanks for the status update and for helping move this along!
The singleSelection?: EuiComboBoxSingleSelectionShape | boolean; The "Single selection" section it the docs explains it best, I think:
So passing an object containing The logic in both checks you mention appear to accomplish what they mean to given the truthy-falsy nature of the prop. |
ok. cool. I fixed in f805215. Yeah, I've learned not to make many assumptions since usually at least one of the below surprises someone that touched the code (especially where types were/are not present):
(and more) Also, consider the following code:
If Lastly, in my commit fixing this I adhered to https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md. This means there are a two or three |
We'd be ok with |
11902a4
to
321b768
Compare
f398cfa
to
328405b
Compare
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.
Mostly some missing CommonProps
extensions
src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
Outdated
Show resolved
Hide resolved
src/components/combo_box/combo_box_options_list/combo_box_option.tsx
Outdated
Show resolved
Hide resolved
jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2838/ |
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 looks ready to go.
Thanks for your work and patience, @dimitropoulos!
Thanks @dimitropoulos for this PR. Certainly a big one and it's a big help getting the library closer to being fully TS! |
thanks all! and as with all the others: if any kind of "this was prop was typed as not optional but actually it's supposed to be optional" thing comes up with this or any of the others - please feel free to ping me. I can only work on this project nights/weekends but I'll do my best to help if I made any mistakes. :) |
to reflect that fact that, as of the ComboBox -> TypeScript in elastic#2838 it is now actually a prod dependency
* adds react-autosize type from recent update * moves @types/react-input-autosize from devDependencies to dependencies to reflect that fact that, as of the ComboBox -> TypeScript in #2838 it is now actually a prod dependency
closes: #2664
This is a draft pull request (i.e. work in progress) on converting the ComboBox family to TypeScript.
There are quite a few tough cookies to crack here, haha, I can see why no one has done it yet. Still, this is a huge step in the right direction.
I'm planning on taking quite explicit notes on all notable changes, but I wanted to throw this PR up just to give a first look at where it's headed.