📄 types.ts¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 📦 Imports | 7 |
| 📐 Interfaces | 4 |
| 📑 Type Aliases | 19 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/shared/utils/types.ts
📦 Imports¶
| Name | Source |
|---|---|
ComputedRef |
vue |
MaybeRef |
vue |
MaybeRefOrGetter |
vue |
Ref |
vue |
ShallowRef |
vue |
WatchOptions |
vue |
WatchSource |
vue |
Interfaces¶
Pausable¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
isActive |
Readonly<ShallowRef<boolean>> |
✗ | |
pause |
Fn |
✗ | |
resume |
Fn |
✗ |
Stoppable<StartFnArgs extends any[] = any[]>¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
isPending |
Readonly<Ref<boolean>> |
✗ | |
stop |
Fn |
✗ | |
start |
(...args: StartFnArgs) => void |
✗ |
ConfigurableFlush¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
flush |
WatchOptions['flush'] |
✓ |
ConfigurableFlushSync¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
flush |
WatchOptions['flush'] |
✓ |
Type Aliases¶
Fn¶
/* * Void function /
AnyFn¶
/* * Any function /
RemovableRef<T>¶
/* * A ref that allow to set null or undefined /
type RemovableRef<T> = Omit<Ref<T>, 'value'> & {
get value(): T
set value(value: T | null | undefined)
};
ReadonlyRefOrGetter<T>¶
/* * Maybe it's a computed ref, or a readonly value, or a getter function /
DeepMaybeRef<T>¶
/*
* Make all the nested attributes of an object or array to MaybeRefreactive or ref
*
* ts
* UnwrapRef<DeepMaybeRef<T>> === T
*
type DeepMaybeRef<T> = T extends Ref<infer V>
? MaybeRef<V>
: T extends Array<any> | object
? { [K in keyof T]: DeepMaybeRef<T[K]> }
: MaybeRef<T>;
Arrayable<T>¶
ElementOf<T>¶
/* * Infers the element type of an array /
ShallowUnwrapRef<T>¶
Awaitable<T>¶
ArgumentsType<T>¶
Awaited<T>¶
/* * Compatible with versions below TypeScript 4.5 Awaited /
type Awaited<T> = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode
T extends object & { then: (onfulfilled: infer F, ...args: infer _) => any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped
F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument
Awaited<V> : // recursively unwrap the value
never : // the argument to `then` was not callable
T;
Promisify<T>¶
PromisifyFn<T extends AnyFn extends AnyFn>¶
type PromisifyFn<T extends AnyFn extends AnyFn> = (...args: ArgumentsType<T>) => Promisify<ReturnType<T>>;
MultiWatchSources¶
MapSources<T>¶
MapOldSources<T, Immediate>¶
type MapOldSources<T, Immediate> = {
[K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
};
Mutable<T>¶
IfAny<T, Y, N>¶
IsAny<T>¶
/*
* will return true if T is any, or false otherwise
/