frontend/.pnpm-store/v3/files/c8/e091f77b5ebbdd0e8e88e1db4903ebeac4edd344834868ba5a4b6a13541db978fc86069ff3976d5c00192249f0a879a68ce0f3d655286844fc7bafafafb414

33 lines
1.2 KiB
Plaintext

/**
Simplifies a type while including and/or excluding certain types from being simplified. Useful to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
This type is **experimental** and was introduced as a result of this {@link https://github.com/sindresorhus/type-fest/issues/436 issue}. It should be used with caution.
@internal
@experimental
@see Simplify
@category Object
*/
export type ConditionalSimplify<Type, ExcludeType = never, IncludeType = unknown> = Type extends ExcludeType
? Type
: Type extends IncludeType
? {[TypeKey in keyof Type]: Type[TypeKey]}
: Type;
/**
Recursively simplifies a type while including and/or excluding certain types from being simplified.
This type is **experimental** and was introduced as a result of this {@link https://github.com/sindresorhus/type-fest/issues/436 issue}. It should be used with caution.
See {@link ConditionalSimplify} for usages and examples.
@internal
@experimental
@category Object
*/
export type ConditionalSimplifyDeep<Type, ExcludeType = never, IncludeType = unknown> = Type extends ExcludeType
? Type
: Type extends IncludeType
? {[TypeKey in keyof Type]: ConditionalSimplifyDeep<Type[TypeKey], ExcludeType, IncludeType>}
: Type;