Skip to main content

Type Alias: ReplaceExactType<T, ConditionType, ReplacementType>

ReplaceExactType<T, ConditionType, ReplacementType> = [T] extends [ConditionType] ? [ConditionType] extends [T] ? ReplacementType : T : T

Defined in: src/sdk/utils/types/UtilityTypes.ts:108

Conditionally replaces a type with another one if the former equals a specified type. The type to replace is not distributed if it is a union.

Type Parameters

Type ParameterDescription
TThe type to replace.
ConditionTypeThe type that T must be equal to in order to be replaced.
ReplacementTypeThe type with which to replace T if it equals ConditionType.