Skip to content

Commit

Permalink
TS fixes: adding Type where needed (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kc13greiner authored Jul 10, 2024
1 parent 7c76dd3 commit 3761ceb
Showing 1 changed file with 15 additions and 25 deletions.
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

0 comments on commit 3761ceb

Please sign in to comment.