Export our 'unwrap' types so that downstream packages can create combinators that TS will accept. ()

This commit is contained in:
CyrusNajmabadi 2018-11-28 13:33:33 -08:00 committed by GitHub
parent af9671a4dd
commit e53f746c35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions
sdk/nodejs

View File

@ -618,7 +618,7 @@ export type Inputs = Record<string, Input<any>>;
* In other words, this should not be used as the shape of an object: `{ a: Promise<Output<...>> }`.
* It should always either be `{ a: Promise<NonOutput> }` or just `{ a: Output<...> }`.
*/
type Unwrap<T> =
export type Unwrap<T> =
// 1. If we have a promise, just get the type it itself is wrapping and recursively unwrap that.
// 2. Otherwise, if we have an output, do the same as a promise and just unwrap the inner type.
// 3. Otherwise, we have a basic type. Just unwrap that.
@ -631,7 +631,7 @@ type primitive = Function | string | number | boolean | undefined | null;
/**
* Handles encountering basic types when unwrapping.
*/
type UnwrapSimple<T> =
export type UnwrapSimple<T> =
// 1. Any of the primitive types just unwrap to themselves.
// 2. An array of some types unwraps to an array of that type itself unwrapped. Note, due to a
// TS limitation we cannot express that as Array<Unwrap<U>> due to how it handles recursive
@ -646,8 +646,8 @@ type UnwrapSimple<T> =
T extends object ? UnwrappedObject<T> :
never;
interface UnwrappedArray<T> extends Array<Unwrap<T>> {}
export interface UnwrappedArray<T> extends Array<Unwrap<T>> {}
type UnwrappedObject<T> = {
export type UnwrappedObject<T> = {
[P in keyof T]: Unwrap<T[P]>;
};