/** * @since 1.0.0 */ import type { Option } from "@fp-ts/core/Option"; import type { Equal } from "@fp-ts/data/Equal"; declare const TagTypeId: unique symbol; /** * @since 1.0.0 * @category symbol */ export type TagTypeId = typeof TagTypeId; /** * @since 1.0.0 * @category models */ export interface Tag { readonly _id: TagTypeId; readonly _S: (_: Service) => Service; } /** * @since 1.0.0 */ export declare namespace Tag { type Service> = T extends Tag ? A : never; } /** * Specifying the key will make the Tag global, meaning two tags with the same * key will map to the same instance. * * Note: this is useful for cases where live reload can happen and it is * desireable to preserve the instance across reloads. * * @since 1.0.0 * @category constructors */ export declare const Tag: (key?: string) => Tag; declare const TypeId: unique symbol; /** * @since 1.0.0 * @category symbol */ export type TypeId = typeof TypeId; /** * @since 1.0.0 * @category models */ export type Tags = R extends infer S ? Tag : never; /** * @since 1.0.0 * @category models */ export interface Context extends Equal { readonly _id: TypeId; readonly _S: (_: Services) => unknown; } /** * @since 1.0.0 * @category guards */ export declare const isContext: (u: unknown) => u is Context; /** * @since 1.0.0 * @category guards */ export declare const isTag: (u: unknown) => u is Tag; /** * @since 1.0.0 * @category constructors */ export declare const empty: () => Context; /** * @since 1.0.0 * @category constructors */ export declare const make: >(tag: T, service: Tag.Service) => Context>; /** * @since 1.0.0 * @category mutations */ export declare const add: { >(self: Context, tag: Tag, service: Tag.Service): Context>; >(tag: T, service: Tag.Service): (self: Context) => Context | Services>; }; /** * @since 1.0.0 * @category getters */ export declare const get: { >(self: Context, tag: T): T extends Tag ? S : never; >(tag: T): (self: Context) => T extends Tag ? S : never; }; /** * @since 1.0.0 * @category unsafe */ export declare const unsafeGet: { (self: Context, tag: Tag): S; (tag: Tag): (self: Context) => S; }; /** * @since 1.0.0 * @category getters */ export declare const getOption: { (self: Context, tag: Tag): Option; (tag: Tag): (self: Context) => Option; }; /** * @since 1.0.0 * @category mutations */ export declare const merge: { (self: Context, that: Context): Context; (that: Context): (self: Context) => Context; }; /** * @since 1.0.0 * @category mutations */ export declare const prune: >>(...tags: S) => (self: Context) => Context<{ [k in keyof S]: Tag.Service; }[number]>; export {}; //# sourceMappingURL=Context.d.ts.map