mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-02 20:59:15 +01:00
* feat: update prettier configuration for print width * chore: apply code formatting to entire repository * fix: remove build files * fix: format issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
18 lines
418 B
TypeScript
18 lines
418 B
TypeScript
export const createDefinition = <const TKeys extends string[], TOptions extends { defaultValue: TKeys[number] } | void>(
|
|
values: TKeys,
|
|
options: TOptions,
|
|
) => ({
|
|
values,
|
|
defaultValue: options?.defaultValue as TOptions extends {
|
|
defaultValue: infer T;
|
|
}
|
|
? T
|
|
: undefined,
|
|
});
|
|
|
|
export type inferDefinitionType<TDefinition> = TDefinition extends {
|
|
values: readonly (infer T)[];
|
|
}
|
|
? T
|
|
: never;
|