generated from EyeSeeTea/dhis2-app-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selector components full typed and change generic T to Value
- Loading branch information
Showing
3 changed files
with
151 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
export type SelectorOption<T extends string = string> = { | ||
value: T; | ||
export type SelectorOption<Value extends string = string> = { | ||
value: Value; | ||
label: string; | ||
disabled?: boolean; | ||
}; | ||
|
||
export function getLabelFromValue<T extends string = string>( | ||
value: SelectorOption["value"], | ||
options: SelectorOption<T>[] | ||
export function getLabelFromValue<Value extends string = string>( | ||
value: Value, | ||
options: SelectorOption<Value>[] | ||
) { | ||
return options.find(option => option.value === value)?.label; | ||
} |