mnemonica 0.9.975 → 0.9.977
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +10 -2
- package/build/index.js +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ type hooksOpts = {
|
|
|
11
11
|
type hook = {
|
|
12
12
|
(opts: hooksOpts): void;
|
|
13
13
|
};
|
|
14
|
+
type constructorOptions = {
|
|
15
|
+
useOldStyle: boolean;
|
|
16
|
+
strictChain: boolean;
|
|
17
|
+
blockErrors: boolean;
|
|
18
|
+
submitStack: boolean;
|
|
19
|
+
awaitReturn: boolean;
|
|
20
|
+
bindedProto: boolean;
|
|
21
|
+
};
|
|
14
22
|
type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
|
|
15
23
|
type SN = Record<string, new () => unknown>;
|
|
16
24
|
interface IDefinitorInstance<N extends object, S> {
|
|
@@ -21,9 +29,9 @@ interface IDefinitorInstance<N extends object, S> {
|
|
|
21
29
|
registerHook: (hookType: hooksTypes, cb: hook) => void;
|
|
22
30
|
}
|
|
23
31
|
interface IDefinitor<P extends object, SubTypeName extends string> {
|
|
24
|
-
<PP extends object, T, M extends Proto<P, Proto<PP, T>>, S extends SN & M>(this: unknown, TypeName: SubTypeName, constructHandler: IDEF<T>, proto?: PP, config?:
|
|
32
|
+
<PP extends object, T, M extends Proto<P, Proto<PP, T>>, S extends SN & M>(this: unknown, TypeName: SubTypeName, constructHandler: IDEF<T>, proto?: PP, config?: constructorOptions): IDefinitorInstance<M, S>;
|
|
25
33
|
}
|
|
26
|
-
export declare const define: <T, P extends object, N extends Proto<P, T>, S extends SN & N, R extends IDefinitorInstance<N, S>>(this: unknown, TypeName?: string, constructHandler?: IDEF<T> | undefined, proto?: P | undefined, config?:
|
|
34
|
+
export declare const define: <T, P extends object, N extends Proto<P, T>, S extends SN & N, R extends IDefinitorInstance<N, S>>(this: unknown, TypeName?: string, constructHandler?: IDEF<T> | undefined, proto?: P | undefined, config?: constructorOptions) => R;
|
|
27
35
|
export declare const lookup: TypeLookup;
|
|
28
36
|
export declare const apply: <E extends object, T extends object, S extends Proto<E, T>>(entity: E, Constructor: IDEF<T>, args?: unknown[]) => { [key in keyof S]: S[key]; };
|
|
29
37
|
export declare const call: <E extends object, T extends object, S extends Proto<E, T>>(entity: E, Constructor: IDEF<T>, ...args: unknown[]) => { [key in keyof S]: S[key]; };
|
package/build/index.js
CHANGED
|
@@ -9,7 +9,7 @@ exports.defaultTypes = descriptors_1.descriptors.defaultTypes;
|
|
|
9
9
|
function checkThis(pointer) {
|
|
10
10
|
return pointer === exports.mnemonica || pointer === exports;
|
|
11
11
|
}
|
|
12
|
-
const define = function (TypeName, constructHandler, proto, config
|
|
12
|
+
const define = function (TypeName, constructHandler, proto, config) {
|
|
13
13
|
const types = checkThis(this) ? exports.defaultTypes : this || exports.defaultTypes;
|
|
14
14
|
return types.define(TypeName, constructHandler, proto, config);
|
|
15
15
|
};
|