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

TS fixes: adding Type where needed #19

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,8 @@ export const UserProfilesSelectable = <Option extends UserProfileWithAvatar | nu
return (
<EuiSelectable
data-test-subj={props['data-test-subj']}
// @ts-expect-error upgrade typescript v5.1.6
options={displayedOptions}
onChange={(
nextOptions: Array<EuiSelectableOption<{ data: Partial<UserProfileWithAvatar> }>>
) => {
onChange={(nextOptions: SelectableOption[]) => {
if (!onChange) {
return;
}
Expand Down Expand Up @@ -330,34 +327,27 @@ export const UserProfilesSelectable = <Option extends UserProfileWithAvatar | nu
noMatchesMessage={noMatchesMessage}
emptyMessage={emptyMessage}
errorMessage={errorMessage}
renderOption={(option, searchValue) => {
// @ts-expect-error upgrade typescript v5.1.6
renderOption={(option: SelectableOption, searchValue) => {
if (option.user) {
// @ts-expect-error upgrade typescript v5.1.6
const displayName = getUserDisplayName(option.user);
return (
<>
<div className="eui-textTruncate">
<EuiHighlight search={searchValue}>{displayName}</EuiHighlight>
</div>
{
/* @ts-expect-error upgrade typescript v5.1.6 */
option.user.email && option.user.email !== displayName ? (
<EuiText
size={'xs'}
color={option.disabled ? 'disabled' : 'subdued'}
className="eui-textTruncate"
>
{searchValue ? (
/* @ts-expect-error upgrade typescript v5.1.6 */
<EuiHighlight search={searchValue}>{option.user.email}</EuiHighlight>
) : (
/* @ts-expect-error upgrade typescript v5.1.6 */
option.user.email
)}
</EuiText>
) : undefined
}
{option.user.email && option.user.email !== displayName ? (
<EuiText
size={'xs'}
color={option.disabled ? 'disabled' : 'subdued'}
className="eui-textTruncate"
>
{searchValue ? (
<EuiHighlight search={searchValue}>{option.user.email}</EuiHighlight>
) : (
option.user.email
)}
</EuiText>
) : undefined}
</>
);
}
Expand Down
Loading