UNPKG

@brizy/media-gallery

Version:
30 lines (29 loc) 802 B
import { NewType } from "~/types/NewType"; import { Id } from "~/utils/number/Id"; declare enum itemId { type = "itemId" } export type ItemId = NewType<string, itemId>; /** * Check if the string value is a ItemId value */ export declare const is: (s: string) => s is ItemId; /** * Try to read a ItemId value from a string */ export declare const fromString: (v: string) => ItemId; /** * from itemId to string */ export declare const toString: (v: ItemId) => string; /** * Create a ItemId value from an numeric Id */ export declare const fromId: (id: Id) => ItemId; /** * Converts a ItemId value to an numeric Id * * Note: A ItemId value contains a Id value inside, so we can afford this dangerous forced conversion to Id */ export declare const toId: (itemId: ItemId) => Id; export {};