<
const Scope extends string | StoreScopeTag,
const C extends StoreContractValue
>(
scope: Scope,
contract: C
): RegisteredWithContract<
ScopeKeyOf<Scope>,
C["spec"],
C,
Scope extends StoreScopeTag ? Scope : undefined
>Register a scope on an aggregate Service without creating a standalone class.
constructorsService
Source src/Store.ts:161918 lines
export const const register: <
const Scope extends string | StoreScopeTag,
const C extends StoreContractValue
>(
scope: Scope,
contract: C
) => RegisteredWithContract<
ScopeKeyOf<Scope>,
C["spec"],
C,
Scope extends StoreScopeTag ? Scope : undefined
>
Register a scope on an aggregate
Service
without creating a standalone class.
register = <
const function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope extends string | StoreScopeTag,
const function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue,
>(
scope: const Scope extends string | StoreScopeTagscope: function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope,
contract: const C extends StoreContractValuecontract: function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C,
): type RegisteredWithContract<K extends string, S extends StoreSpec, C extends StoreContractValue, Tag extends StoreScopeTag | undefined = undefined> = Omit<StoreRegistration<K, S>, "contract" | "tag"> & {
readonly contract: C;
} & (Tag extends undefined ? unknown : {
readonly tag: Tag;
})
Registration with a concrete contract attached (no optional widening).
RegisteredWithContract<
type ScopeKeyOf<Scope extends string | StoreScopeTag> = Scope extends string ? Scope : Scope extends {
readonly key: infer Id extends string;
} ? Id : never
ScopeKeyOf<function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope>,
function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C["spec"],
function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C,
function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope extends StoreScopeTag ? function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope : undefined
> =>
makeRegistration<Scope, C>(scope: Scope, spec: C & {}): C extends StoreContractValue ? Scope extends StoreScopeTag ? RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope> : RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, undefined> : Scope extends StoreScopeTag ? StoreRegistration<ScopeKeyOf<Scope>, AsStoreSpec<C>> & {
...;
} : StoreRegistration<...>
makeRegistration(scope: const Scope extends string | StoreScopeTagscope, contract: const C extends StoreContractValuecontract) as unknown as type RegisteredWithContract<K extends string, S extends StoreSpec, C extends StoreContractValue, Tag extends StoreScopeTag | undefined = undefined> = Omit<StoreRegistration<K, S>, "contract" | "tag"> & {
readonly contract: C;
} & (Tag extends undefined ? unknown : {
readonly tag: Tag;
})
Registration with a concrete contract attached (no optional widening).
RegisteredWithContract<
type ScopeKeyOf<Scope extends string | StoreScopeTag> = Scope extends string ? Scope : Scope extends {
readonly key: infer Id extends string;
} ? Id : never
ScopeKeyOf<function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope>,
function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C["spec"],
function (type parameter) C in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>C,
function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope extends StoreScopeTag ? function (type parameter) Scope in <const Scope extends string | StoreScopeTag, const C extends StoreContractValue>(scope: Scope, contract: C): RegisteredWithContract<ScopeKeyOf<Scope>, C["spec"], C, Scope extends StoreScopeTag ? Scope : undefined>Scope : undefined
>;