Type alias Lifted<T>

Lifted<T>: T extends string
    ? LiftedObject<String, NonFunctionPropertyNames<String>>
    : T extends (infer U)[]
        ? LiftedArray<U>
        : T extends object
            ? LiftedObject<T, NonFunctionPropertyNames<T>>
            : {}

The [Lifted] type allows us to express the operation of taking a type, with potentially deeply nested objects and arrays and to then get a type with the same properties, except whose property types are now [Output]s of the original property type.

For example:

 `type X = { A: string, B: { c: boolean } }`

Then Lifted<X> would be equivalent to:

 `...    = { A: Output<string>, B: Output<{ C: Output<boolean> }> }`

[Lifted] is somewhat the opposite of [Unwrap]. It's primary purpose is to allow an instance of [Output] to provide simple access to the properties of [SomeType] directly on the instance itself (instead of haveing to use [.apply]).

This lifting only happens through simple pojo objects and arrays. Functions, for example, are not lifted. So you cannot do:

     const o: Output<string> = ...;
const c: Output<number> = o.charCodeAt(0);

Instead, you still need to write;

     const o: Output<string> = ...;
const c: Output<number> = o.apply(v => v.charCodeAt(0));

Type Parameters

  • T

Generated using TypeDoc