@wooksjs/event-core 0.3.2 → 0.3.4

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/dist/index.cjs CHANGED
@@ -3,7 +3,6 @@
3
3
  var crypto = require('crypto');
4
4
  var logger = require('@prostojs/logger');
5
5
 
6
- // eslint-disable-next-line @typescript-eslint/ban-types
7
6
  function attachHook(target, opts, name) {
8
7
  Object.defineProperty(target, name || 'value', {
9
8
  get: opts.get,
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { TProstoLoggerOptions } from '@prostojs/logger';
4
4
  export declare function attachHook<V = unknown, T extends object | Function = object, P extends PropertyKey = 'value'>(target: T, opts: {
5
5
  get: () => V | undefined;
6
6
  set?: (value: V) => void;
7
- }, name?: P): T & { [name in P]?: V | undefined; };
7
+ }, name?: P): T & THook<V, P>;
8
8
 
9
9
  /**
10
10
  * Create a new event context
@@ -63,6 +63,10 @@ export declare interface TGenericEvent {
63
63
  id?: string;
64
64
  }
65
65
 
66
+ export declare type THook<T = string, K extends PropertyKey = 'value'> = {
67
+ [key in K]: T;
68
+ };
69
+
66
70
  /**
67
71
  * Use existing event context
68
72
  *
package/dist/index.mjs CHANGED
@@ -1,7 +1,6 @@
1
1
  import { randomUUID } from 'crypto';
2
2
  import { ProstoLogger, createConsoleTransort, coloredConsole } from '@prostojs/logger';
3
3
 
4
- // eslint-disable-next-line @typescript-eslint/ban-types
5
4
  function attachHook(target, opts, name) {
6
5
  Object.defineProperty(target, name || 'value', {
7
6
  get: opts.get,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wooksjs/event-core",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "@wooksjs/event-core",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",