UNPKG

@mos-connection/helper

Version:

Helper functions for the MOS-connection library

18 lines 773 B
import { IMOSDuration, IMOSString128, IMOSTime } from '@mos-connection/model'; /** * Converts a MOS data object, * replacing Mos-centric types with their stringified equivalents */ export declare function stringifyMosObject<T extends { [key: string]: any; }>(o: T, strict: boolean): Stringified<T>; type DeepReplace<T, M extends [any, any]> = { [P in keyof T]: T[P] extends M[0] ? Replacement<M, T[P]> : T[P] extends object ? DeepReplace<T[P], M> : T[P]; }; type Replacement<M extends [any, any], T> = M extends any ? ([T] extends [M[0]] ? M[1] : never) : never; export type Stringified<Original> = DeepReplace<Original, [ IMOSString128, string ] | [IMOSDuration, string] | [IMOSTime, string]>; export {}; //# sourceMappingURL=stringifyMosObject.d.ts.map