Skip to content
On this page

Module: util/computed

Type Aliases

Computable

Ƭ Computable<T>: T | Ref<T> | () => T

Type parameters

Name
T

Defined in

profectus/src/util/computed.ts:7


ComputableKeysOf

Ƭ ComputableKeysOf<T>: Pick<T, { [K in keyof T]: T[K] extends Computable<unknown> ? K : never }[keyof T]>

Type parameters

Name
T

Defined in

profectus/src/util/computed.ts:21


GetComputableType

Ƭ GetComputableType<T>: T extends { [DoNotCache]: true } ? T : T extends () => infer S ? Ref<S> : undefined extends T ? undefined : T

Type parameters

Name
T

Defined in

profectus/src/util/computed.ts:9


GetComputableTypeWithDefault

Ƭ GetComputableTypeWithDefault<T, S>: undefined extends T ? S : GetComputableType<NonNullable<T>>

Type parameters

Name
T
S

Defined in

profectus/src/util/computed.ts:16


ProcessedComputable

Ƭ ProcessedComputable<T>: T | Ref<T>

Type parameters

Name
T

Defined in

profectus/src/util/computed.ts:8


UnwrapComputableType

Ƭ UnwrapComputableType<T>: T extends Ref<infer S> ? S : T extends () => infer S ? S : T

Type parameters

Name
T

Defined in

profectus/src/util/computed.ts:19

Variables

DoNotCache

Const DoNotCache: typeof DoNotCache

Defined in

profectus/src/util/computed.ts:5

Functions

convertComputable

convertComputable<T>(obj): ProcessedComputable<T>

Type parameters

Name
T

Parameters

NameType
objComputable<T>

Returns

ProcessedComputable<T>


processComputable

processComputable<T, S>(obj, key): asserts obj is T & { [K in string | number | symbol]: ProcessedComputable<UnwrapComputableType<T[S]>> }

Type parameters

NameType
TT
Sextends string | number | symbol

Parameters

NameType
objT
keyS

Returns

asserts obj is T & { [K in string | number | symbol]: ProcessedComputable<UnwrapComputableType<T[S]>> }