UNPKG

@sitecore/sc-contenthub-webclient-sdk

Version:

Sitecore Content Hub WebClient SDK.

60 lines (59 loc) 1.9 kB
import CultureInfo from "./culture-info"; export interface MapStringTo<T> { [key: string]: T; } export declare class CaseInsensitiveStringMap<T> implements MapStringTo<T> { [key: string]: T; constructor(map?: MapStringTo<T>); } export interface MapNumberTo<T> { [key: number]: T; } /** * Generic type to map cultures to values of a specified type. */ export type MapCultureTo<T> = { [key in CultureInfo]?: T; }; export type NullableResultPromise<T> = Promise<T | null>; export type OptionalResultPromise<T> = Promise<T | undefined>; export type Nullable<T> = T | null; export type Optional<T> = T | undefined; export type UnionKeyToValue<U extends string> = { [K in U]: K; }; export type FromStringIndexTo<K extends string, V> = { [key in K]?: V; }; export type OptionalPropertyOf<T> = Exclude<{ [K in keyof T]: T extends Record<K, T[K]> ? never : K; }[keyof T], undefined>; type KeysWithoutType<T, K> = { [P in keyof T]: Exclude<T[P], undefined> extends K ? never : P; }[keyof T]; /** * A type based on type T without properties of type K. */ export type OmitType<T, K> = Pick<T, KeysWithoutType<T, K>>; export interface KeyValuePair<T, K> { key: T; value: K; } export type Equals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B; export type WritableKeysOf<T> = { [P in keyof T]: Equals<{ [Q in P]: T[P]; }, { -readonly [Q in P]: T[P]; }, P, never>; }[keyof T]; export type WritablePart<T> = Pick<T, WritableKeysOf<T>>; export type JsonArray = Array<JsonValue>; export type JsonObject = { [key: string]: JsonValue; }; export type JsonValue = string | number | boolean | JsonObject | JsonArray | null; export type Object_Unknown = Record<string, unknown>; export type EmptyObject = Omit<Record<any, never>, keyof any>; export type ReadableUploadSource = ArrayBuffer; export {};