/** @typedef {Record} TypedSchema */ /** * @template {any} [T=any] Default is `any` * @typedef {new (...args: any[]) => T} Constructor */ /** * @template {unknown} T * @template {unknown} V * @typedef {T extends StringConstructor * ? string * : T extends BooleanConstructor * ? boolean * : T extends NumberConstructor * ? number * : T extends ArrayConstructor * ? V * : T extends Constructor * ? InstanceType * : T} ExtractType */ /** * @template {TypedSchema} T * @typedef {{ * [K in keyof T]: ExtractType | (T[K]['nullable'] extends true ? null : never); * }} ExtractDataFromSchema */ /** * @template {TypedSchema} T * @typedef {Extract} ExtractKeysFromSchema */ /** @template {TypedSchema} T */ export class TypedData { /** * @param {T} typedSchema * @param {String} [ctxName] */ constructor(typedSchema: T, ctxName?: string); /** * @private * @type {T} */ private __typedSchema; /** * @private * @type {string} */ private __ctxId; /** * @private * @type {ExtractDataFromSchema} */ private __schema; /** * @private * @type {Data} */ private __data; /** @returns {string} */ get uid(): string; /** * @param {ExtractKeysFromSchema} prop * @param {ExtractDataFromSchema[prop]} value */ setValue(prop: ExtractKeysFromSchema, value: ExtractDataFromSchema[Extract]): void; /** @param {Partial>} updObj */ setMultipleValues(updObj: Partial>): void; /** * @template {ExtractKeysFromSchema} K * @param {K} prop * @returns {ExtractDataFromSchema[K]} */ getValue>(prop: K): ExtractDataFromSchema[K]; /** * @template {ExtractKeysFromSchema} K * @param {K} prop * @param {(newVal: ExtractDataFromSchema[K]) => void} handler */ subscribe>(prop: K, handler: (newVal: ExtractDataFromSchema[K]) => void): { remove: () => void; callback: Function; }; remove(): void; } export type TypedSchema = Record; export type Constructor = new (...args: any[]) => T; export type ExtractType = T extends StringConstructor ? string : T extends BooleanConstructor ? boolean : T extends NumberConstructor ? number : T extends ArrayConstructor ? V : T extends Constructor ? InstanceType : T; export type ExtractDataFromSchema = { [K in keyof T]: ExtractType | (T[K]["nullable"] extends true ? null : never); }; export type ExtractKeysFromSchema = Extract; //# sourceMappingURL=TypedData.d.ts.map