Fix extends undefined checks

This commit is contained in:
thepaperpilot 2023-04-30 11:37:23 -05:00
parent c85155f658
commit ea70d3cce2
2 changed files with 4 additions and 4 deletions

View file

@ -52,7 +52,7 @@ export interface BaseTooltip {
export type Tooltip<T extends TooltipOptions> = Replace< export type Tooltip<T extends TooltipOptions> = Replace<
T & BaseTooltip, T & BaseTooltip,
{ {
pinnable: T["pinnable"] extends undefined ? false : T["pinnable"]; pinnable: undefined extends T["pinnable"] ? false : T["pinnable"];
pinned: T["pinnable"] extends true ? Ref<boolean> : undefined; pinned: T["pinnable"] extends true ? Ref<boolean> : undefined;
display: GetComputableType<T["display"]>; display: GetComputableType<T["display"]>;
classes: GetComputableType<T["classes"]>; classes: GetComputableType<T["classes"]>;

View file

@ -41,11 +41,11 @@ export interface Modifier {
/** /**
* Utility type used to narrow down a modifier type that will have a description and/or enabled property based on optional parameters, T and S (respectively). * Utility type used to narrow down a modifier type that will have a description and/or enabled property based on optional parameters, T and S (respectively).
*/ */
export type ModifierFromOptionalParams<T, S> = T extends undefined export type ModifierFromOptionalParams<T, S> = undefined extends T
? S extends undefined ? undefined extends S
? Omit<WithRequired<Modifier, "invert" | "getFormula">, "description" | "enabled"> ? Omit<WithRequired<Modifier, "invert" | "getFormula">, "description" | "enabled">
: Omit<WithRequired<Modifier, "invert" | "enabled" | "getFormula">, "description"> : Omit<WithRequired<Modifier, "invert" | "enabled" | "getFormula">, "description">
: S extends undefined : undefined extends S
? Omit<WithRequired<Modifier, "invert" | "description" | "getFormula">, "enabled"> ? Omit<WithRequired<Modifier, "invert" | "description" | "getFormula">, "enabled">
: WithRequired<Modifier, "invert" | "enabled" | "description" | "getFormula">; : WithRequired<Modifier, "invert" | "enabled" | "description" | "getFormula">;