typeomatica 0.3.34 → 0.3.36

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/jest.config.js CHANGED
@@ -1,8 +1,11 @@
1
1
  module.exports = {
2
2
  preset: 'ts-jest',
3
3
  testEnvironment: 'node',
4
- testMatch: ['**/test/**/index.ts', '**/test/**/addition.js'],
4
+ testMatch: ['**/test/**/index.ts'],
5
+ // testMatch: ['**/test/**/index.ts', '**/test/**/addition.js'],
5
6
  transform : {
6
- '\\./test/*.ts$': ['ts-jest', { tsconfig : './tsconfig.jest.json' }]
7
+ '\\./test/*.ts$': ['ts-jest', {
8
+ tsconfig : './tsconfig.jest.json'
9
+ }]
7
10
  }
8
- };
11
+ };
package/lib/errors.js CHANGED
@@ -8,3 +8,4 @@ exports.ErrorsNames = {
8
8
  RIP_FUNCTIONS: 'Functions are Restricted',
9
9
  FORBIDDEN_RE: 'Re-Assirnment is Forbidden'
10
10
  };
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEA,QAAA,WAAW,GAAG;IAC1B,aAAa,EAAE,eAAe;IAC9B,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,qCAAqC;IACnD,aAAa,EAAE,0BAA0B;IACzC,YAAY,EAAE,4BAA4B;CAC1C,CAAC"}
package/lib/fields.js CHANGED
@@ -25,3 +25,4 @@ class FieldConstructor {
25
25
  exports.FieldConstructor = FieldConstructor;
26
26
  Object.freeze(FieldConstructor.prototype);
27
27
  Object.seal(FieldConstructor.prototype);
28
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,qCAAuC;AAEvC,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAenD,MAAa,gBAAgB;IAE5B,IAAW,GAAG;QACb,MAAM,IAAI,GAAG,IAAI,CAAC;QAClB,OAAO;YACN,OAAO,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACjC,CAAC,CAAC;IACH,CAAC;IACD,IAAW,GAAG;QACb,OAAO;YACN,MAAM,IAAI,SAAS,CAAC,oBAAW,CAAC,YAAY,CAAC,CAAC;QAC/C,CAAC,CAAC;IACH,CAAC;IACD,YAAa,KAAc;QAC1B,IAAI,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC;IAClC,CAAC;IACD,MAAM,KAAK,kBAAkB;QAC5B,OAAO,kBAAkB,CAAC;IAC3B,CAAC;CACD;AAnBD,4CAmBC;AAoCD,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAC1C,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- type Proto<P, T> = Pick<P, Exclude<keyof P, keyof T>> & T;
2
- export declare const BaseConstructorPrototype: <P extends object, S extends Proto<T, P>, T extends {
3
- (): P;
4
- new (): { [key in keyof S]: S[key]; };
5
- }>(this: T, InstanceTarget?: P) => T;
1
+ export declare const BaseConstructorPrototype: {
2
+ (): void;
3
+ new (): unknown;
4
+ };
6
5
  export declare class BaseClass extends BaseConstructorPrototype {
7
6
  }
8
7
  export { FieldConstructor } from './fields';
package/lib/index.js CHANGED
@@ -77,7 +77,7 @@ const handlers = {
77
77
  },
78
78
  };
79
79
  const BaseTarget = Object.create(null);
80
- const BaseConstructorPrototype = function (InstanceTarget = BaseTarget) {
80
+ exports.BaseConstructorPrototype = function (InstanceTarget = BaseTarget) {
81
81
  if (!new.target) {
82
82
  const self = exports.BaseConstructorPrototype.bind(this, InstanceTarget);
83
83
  self.prototype = {
@@ -95,7 +95,6 @@ const BaseConstructorPrototype = function (InstanceTarget = BaseTarget) {
95
95
  Reflect.setPrototypeOf(protoPointer, InstancePrototype);
96
96
  return this;
97
97
  };
98
- exports.BaseConstructorPrototype = BaseConstructorPrototype;
99
98
  Object.defineProperty(module, 'exports', {
100
99
  get() {
101
100
  return exports.BaseConstructorPrototype;
@@ -124,7 +123,21 @@ Object.defineProperty(module.exports, 'FieldConstructor', {
124
123
  });
125
124
  Object.defineProperty(module.exports, 'Strict', {
126
125
  get() {
127
- return exports.BaseConstructorPrototype;
126
+ return function (prototypeTarget) {
127
+ const decorator = function (Target) {
128
+ const Targeted = exports.BaseConstructorPrototype.call(Target, prototypeTarget);
129
+ const MyProxyClass = new Proxy(Targeted, {
130
+ construct(target, argumentsList, newTarget) {
131
+ const result = Reflect.construct(target, argumentsList, newTarget);
132
+ debugger;
133
+ return result;
134
+ },
135
+ });
136
+ return MyProxyClass;
137
+ };
138
+ return decorator;
139
+ };
128
140
  },
129
141
  enumerable: true
130
142
  });
143
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,qCAAuC;AAEvC,mCAOiB;AAEjB,qCAA4C;AAE5C,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/B,UAAU,EAAV,kBAAU;IACV,OAAO,EAAP,eAAO;IACP,OAAO,EAAP,eAAO;IACP,OAAO,EAAP,eAAO;IACP,SAAS,EAAT,iBAAS;CACT,CAAC,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,EAAE;IAE1C,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,YAAoB,EAAE,QAAgB;QAC1D,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QACvC,OAAO;YACN,GAAG;gBACF,MAAM,cAAc,GAAG,IAAI,CAAC;gBAC5B,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;oB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,CAAC,CAAC;YAEF,OAAO,SAAS,CAAC;QAElB,CAAC,CAAC;IAGH,CAAC;IACD,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC"}
@@ -6,3 +6,4 @@ const functions = () => {
6
6
  throw new TypeError(errors_1.ErrorsNames.RIP_FUNCTIONS);
7
7
  };
8
8
  exports.functions = functions;
9
+ //# sourceMappingURL=functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,sCAAwC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC7B,MAAM,IAAI,SAAS,CAAC,oBAAW,CAAC,aAAa,CAAC,CAAC;AAChD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
@@ -20,3 +20,4 @@ const isPrimitive = (value) => {
20
20
  return PRIMITIVE_TYPES.includes(typeof value);
21
21
  };
22
22
  exports.isPrimitive = isPrimitive;
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,MAAM,eAAe,GAAG;IACvB,QAAQ;IACR,QAAQ;IACR,SAAS;CACT,CAAC;AAEK,MAAM,WAAW,GAAG,CAAC,KAAc,EAAE,EAAE;IAC7C,OAAO,eAAe,CAAC,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB"}
@@ -14,3 +14,4 @@ const nullish = (value) => {
14
14
  };
15
15
  };
16
16
  exports.nullish = nullish;
17
+ //# sourceMappingURL=nullish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nullish.js","sourceRoot":"","sources":["../../src/types/nullish.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,sCAAwC;AAEjC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO;QACN,GAAG;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,GAAG;YACF,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,oBAAW,CAAC,aAAa,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACb,CAAC;KACD,CAAA;AACF,CAAC,CAAC;AAVW,QAAA,OAAO,WAUlB"}
@@ -18,3 +18,4 @@ const objects = (value) => {
18
18
  };
19
19
  };
20
20
  exports.objects = objects;
21
+ //# sourceMappingURL=objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.js","sourceRoot":"","sources":["../../src/types/objects.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,sCAAwC;AAEjC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO;QACN,GAAG;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,GAAG,CAAC,gBAAyB;YAC5B,IAAI,gBAAgB,YAAY,MAAM,IAAI,gBAAgB,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC9F,KAAK,GAAG,gBAAgB,CAAC;gBACzB,OAAO,KAAK,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,oBAAW,CAAC,aAAa,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACb,CAAC;KACD,CAAA;AACF,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
@@ -47,3 +47,4 @@ const primitives = (initialValue) => {
47
47
  };
48
48
  };
49
49
  exports.primitives = primitives;
50
+ //# sourceMappingURL=primitives.js.map
@@ -0,0 +1 @@
1
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AAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAE1C,IAAI,QAAQ,YAAY,KAAK,CAAC,WAAW,EAAE,CAAC;gBAC3C,KAAK,GAAG,QAAQ,CAAC;gBACjB,OAAO,KAAK,CAAC;YACd,CAAC;YAED,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,oBAAW,CAAC,aAAa,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC,CAAC;AAhEW,QAAA,UAAU,cAgErB"}
@@ -18,3 +18,4 @@ const special = (value) => {
18
18
  };
19
19
  };
20
20
  exports.special = special;
21
+ //# sourceMappingURL=special.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"special.js","sourceRoot":"","sources":["../../src/types/special.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,sCAAwC;AAEjC,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO;QACN,GAAG;YACF,OAAO,KAAK,CAAC;QACd,CAAC;QACD,GAAG,CAAC,gBAAwB;YAC3B,IAAI,OAAO,gBAAgB,KAAK,OAAO,KAAK,EAAE,CAAC;gBAC9C,KAAK,GAAG,gBAAgB,CAAC;gBACzB,OAAO,KAAK,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,SAAS,CAAC,oBAAW,CAAC,aAAa,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACb,CAAC;KACD,CAAA;AACF,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typeomatica",
3
- "version": "0.3.34",
3
+ "version": "0.3.36",
4
4
  "description": "type logic against javascript metaprogramming",
5
5
  "engines": {
6
6
  "node": ">=16"
@@ -9,9 +9,10 @@
9
9
  "scripts": {
10
10
  "build": "rm -rf ./lib && npx tsc --pretty",
11
11
  "buildlint": "rm -rf ./lib && npx tsc --pretty && npm run lint",
12
- "lint": "npx eslint --fix --ignore-path .gitignore ./lib",
12
+ "lint": "npx eslint --fix --ignore-pattern ./lib",
13
13
  "test": "npx jest",
14
14
  "test:cov": "npx jest --collectCoverage",
15
+ "test:addition": "npm run build && node --test --experimental-test-coverage ./test/addition.js",
15
16
  "debug": "node --inspect-brk ./node_modules/jest/bin/jest.js --runInBand",
16
17
  "debug:old": "npx --node-options=--inspect-brk jest",
17
18
  "prepare": "husky install"
@@ -31,7 +32,7 @@
31
32
  },
32
33
  "devDependencies": {
33
34
  "@types/jest": "^29.5.12",
34
- "@types/node": "^18.19.30",
35
+ "@types/node": "^18.19.33",
35
36
  "@typescript-eslint/eslint-plugin": "^6.21.0",
36
37
  "@typescript-eslint/parser": "^6.21.0",
37
38
  "eslint": "^8.57.0",
@@ -40,8 +41,10 @@
40
41
  "json5": "^2.2.3",
41
42
  "lint-staged": "^13.3.0",
42
43
  "set-value": "^4.1.0",
43
- "ts-jest": "^29.1.2",
44
44
  "ts-node": "^10.9.2",
45
- "typescript": "^5.4.4"
45
+ "typescript": "^5.4.5"
46
+ },
47
+ "dependencies": {
48
+ "ts-jest": "^29.1.3"
46
49
  }
47
50
  }
package/src/index.ts CHANGED
@@ -119,6 +119,7 @@ const handlers = {
119
119
  return result;
120
120
  },
121
121
  // defineProperty(target: object, key: string, descriptor: object) {
122
+ // debugger;
122
123
  // Reflect.defineProperty(target, key, descriptor);
123
124
  // return true;
124
125
  // }
@@ -135,7 +136,7 @@ export const BaseConstructorPrototype = function <
135
136
  S extends Proto<T, P>,
136
137
  T extends {
137
138
  (): P
138
- new (): {
139
+ new(): {
139
140
  [key in keyof S]: S[key]
140
141
  }
141
142
  },
@@ -149,6 +150,7 @@ export const BaseConstructorPrototype = function <
149
150
  prototype: {
150
151
  constructor: typeof BaseConstructorPrototype
151
152
  }
153
+ //@ts-ignore
152
154
  } = BaseConstructorPrototype.bind(this, InstanceTarget);
153
155
 
154
156
  self.prototype = {
@@ -171,8 +173,47 @@ export const BaseConstructorPrototype = function <
171
173
  Reflect.setPrototypeOf(protoPointer, InstancePrototype);
172
174
  return this;
173
175
 
176
+ } as {
177
+ new(): unknown
178
+ (): void
174
179
  };
175
180
 
181
+ // const BaseConstructorProtoProxy = new Proxy(BaseConstructorPrototype, {
182
+ // construct (target: Function, argumentsList: unknown[], newTarget: Function) {
183
+ // debugger;
184
+ // console.log('.construct invocation');
185
+ // const result = Reflect.construct(target, argumentsList, newTarget);
186
+ // debugger;
187
+ // return result;
188
+ // },
189
+ // get (target: object, prop: string | symbol, receiver: object) {
190
+ // debugger;
191
+ // const result = Reflect.get(target, prop, receiver);
192
+ // debugger;
193
+ // return result;
194
+ // },
195
+ // set(_: object, prop: string, value: unknown, receiver: object) {
196
+ // debugger;
197
+ // const result = createProperty(prop, value, receiver);
198
+ // return result;
199
+ // },
200
+ // defineProperty(target: object, key: string, descriptor: object) {
201
+ // debugger;
202
+ // Reflect.defineProperty(target, key, descriptor);
203
+ // return true;
204
+ // },
205
+ // getPrototypeOf(target: object) {
206
+ // debugger;
207
+ // const result = Reflect.getPrototypeOf(target);
208
+ // return result;
209
+ // },
210
+ // setPrototypeOf(target, prototype) {
211
+ // debugger;
212
+ // Reflect.setPrototypeOf(target, prototype);
213
+ // return true;
214
+ // },
215
+ // });
216
+
176
217
  // as ObjectConstructor & {
177
218
  // (): void
178
219
  // // eslint-disable-next-line no-unused-vars
@@ -183,12 +224,14 @@ export const BaseConstructorPrototype = function <
183
224
 
184
225
  Object.defineProperty(module, 'exports', {
185
226
  get() {
227
+ // return BaseConstructorProtoProxy;
186
228
  return BaseConstructorPrototype;
187
229
  },
188
230
  enumerable: true
189
231
  });
190
232
 
191
233
 
234
+ // export class BaseClass extends BaseConstructorProtoProxy { }
192
235
  // eslint-disable-next-line new-cap
193
236
  // @ts-ignore
194
237
  export class BaseClass extends BaseConstructorPrototype { }
@@ -201,7 +244,7 @@ type StrictRuntime = {
201
244
 
202
245
  // export const { StrictPrototype, Strict } = {
203
246
  export const { Strict } = {
204
- // StrictPrototype: BaseConstructorPrototype,
247
+ // Strict: BaseConstructorProtoProxy,
205
248
  Strict: BaseConstructorPrototype,
206
249
  } as {
207
250
  // StrictPrototype: StrictRuntime
@@ -220,15 +263,35 @@ Object.defineProperty(module.exports, 'FieldConstructor', {
220
263
  },
221
264
  enumerable: true
222
265
  });
223
- // Object.defineProperty(module.exports, 'StrictPrototype', {
224
- // get() {
225
- // return BaseConstructorPrototype;
226
- // },
227
- // enumerable: true
228
- // });
229
266
  Object.defineProperty(module.exports, 'Strict', {
230
267
  get() {
231
- return BaseConstructorPrototype;
268
+ return function (prototypeTarget: object) {
269
+ const decorator = function (
270
+ this: object,
271
+ Target: {
272
+ new(): unknown
273
+ (): void
274
+ },
275
+ ) {
276
+ //@ts-ignore
277
+ const Targeted = BaseConstructorPrototype.call(Target, prototypeTarget);
278
+ //@ts-ignore
279
+ const MyProxyClass = new Proxy(Targeted, {
280
+ construct(target, argumentsList, newTarget) {
281
+ //@ts-ignore
282
+ const result = Reflect.construct(target, argumentsList, newTarget);
283
+ debugger;
284
+ return result;
285
+ },
286
+ });
287
+ return MyProxyClass;
288
+ };
289
+
290
+ return decorator;
291
+
292
+ };
293
+ // return BaseConstructorProtoProxy;
294
+ // return BaseConstructorPrototype;
232
295
  },
233
296
  enumerable: true
234
297
  });
package/test/addition.js CHANGED
@@ -1,5 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const { describe, test } = require('node:test');
4
+ const assert = require('node:assert').strict;
5
+
3
6
  const BasePrototype = require('..');
4
7
 
5
8
  // eslint-disable-next-line new-cap
@@ -20,25 +23,27 @@ const baseInstance = new Base;
20
23
  describe('props tests', () => {
21
24
 
22
25
  test('base instance has props', () => {
23
- expect(Object.keys(baseInstance)).toEqual(['numberValue', 'stringValue', 'booleanValue', 'objectValue']);
26
+ const realKeys = Object.keys(baseInstance);
27
+ const needKeys = ['numberValue', 'stringValue', 'booleanValue', 'objectValue'];
28
+ assert.deepEqual(realKeys, needKeys);
24
29
  });
25
30
 
26
31
  test('JavaScript class fields allow re-definition', () => {
27
32
  baseInstance.numberValue = '123';
28
- expect(baseInstance.numberValue).toEqual('123');
33
+ assert.equal(baseInstance.numberValue, '123');
29
34
  });
30
35
 
31
36
  test('everything the rest is the same', () => {
32
- expect(baseInstance.additionalProp).toEqual(321);
33
- expect(() => {
37
+ assert.equal(baseInstance.additionalProp, 321);
38
+ assert.throws(() => {
34
39
  baseInstance.stringValue = 123;
35
- }).toThrow(new TypeError('Type Mismatch'));
36
- expect(() => {
40
+ }, new TypeError('Type Mismatch'));
41
+ assert.throws(() => {
37
42
  baseInstance.booleanValue = 123;
38
- }).toThrow(new TypeError('Type Mismatch'));
39
- expect(() => {
43
+ }, new TypeError('Type Mismatch'));
44
+ assert.throws(() => {
40
45
  baseInstance.objectValue = null;
41
- }).toThrow(new TypeError('Type Mismatch'));
46
+ }, new TypeError('Type Mismatch'));
42
47
  });
43
48
 
44
49
  });
package/test/index.ts CHANGED
@@ -31,6 +31,7 @@ class DecoratedByBase {
31
31
  someProp!: number;
32
32
  }
33
33
 
34
+ // @Strict({ someProp: 123 })
34
35
  class ExtendedDecoratedByBase extends DecoratedByBase {
35
36
  someProp: number;
36
37
  constructor() {
@@ -63,6 +64,7 @@ class Base extends BasePrototype({
63
64
 
64
65
  constructor() {
65
66
  super();
67
+ // debugger;
66
68
  this.stringValue = '123';
67
69
  this.booleanValue = true;
68
70
  this.objectValue = {};
@@ -80,7 +82,9 @@ class Base extends BasePrototype({
80
82
  // });
81
83
  }
82
84
  }
85
+ // debugger;
83
86
  const baseInstance = new Base;
87
+ // debugger;
84
88
 
85
89
  const upperInstance = Object.create(baseInstance);
86
90
 
@@ -93,7 +97,9 @@ class SimpleBase extends BaseClass {
93
97
  // this.stringProp = '123';
94
98
  // }
95
99
  }
100
+ // debugger;
96
101
  const simpleInstance = new SimpleBase;
102
+ // debugger;
97
103
 
98
104
  interface IFCstr<S> {
99
105
  (): void
@@ -227,14 +233,16 @@ describe('props tests', () => {
227
233
  test('decorators works', () => {
228
234
  const rgp = Reflect.getPrototypeOf;
229
235
  // eslint-disable-next-line no-debugger
230
- // debugger;
236
+ debugger;
231
237
  const decorated = new DecoratedByBase;
238
+ debugger;
232
239
  const exdecorated = new ExtendedDecoratedByBase;
240
+ debugger;
233
241
  expect(decoratedSomeProp.valueOf()).toEqual(321);
234
242
  expect(exdecorated.someProp.valueOf()).toEqual(321);
235
243
  expect(decorated.someProp.valueOf()).toEqual(123);
236
244
  const proto = rgp(decorated);
237
- //@ts-ignore;
245
+ //@ts-expect-error;
238
246
  expect(proto.someProp).toEqual(123);
239
247
  });
240
248
 
@@ -274,7 +282,7 @@ describe('props tests', () => {
274
282
 
275
283
  // eslint-disable-next-line no-debugger
276
284
  debugger;
277
- // @ts-ignore
285
+ // @ts-expect-error
278
286
  simpleInstance.stringProp = 123;
279
287
 
280
288
  }).toThrow(new TypeError('Type Mismatch'));
@@ -292,7 +300,7 @@ describe('props tests', () => {
292
300
  test('fails boolean arithmetics', () => {
293
301
  expect(() => {
294
302
 
295
- // @ts-ignore
303
+ // @ts-expect-error
296
304
  baseInstance.booleanValue + 5;
297
305
 
298
306
  }).toThrow(new ReferenceError('Value Access Denied'));
@@ -305,13 +313,13 @@ describe('props tests', () => {
305
313
 
306
314
  // warning!
307
315
  // booleanValue does not rely on baseInstance anymore!
308
- // @ts-ignore
316
+ // @ts-expect-error
309
317
  booleanValue = new Boolean(false);
310
318
 
311
319
  let value = baseInstance.booleanValue.valueOf();
312
320
  expect(value).toEqual(true);
313
321
 
314
- // @ts-ignore
322
+ // @ts-expect-error
315
323
  baseInstance.booleanValue = new Boolean(false);
316
324
  value = baseInstance.booleanValue.valueOf();
317
325
  expect(value).toEqual(false);
@@ -329,7 +337,7 @@ describe('props tests', () => {
329
337
 
330
338
  test('correct object assignment', () => {
331
339
  baseInstance.objectValue = { a: 123 };
332
- // @ts-ignore
340
+ // @ts-expect-error
333
341
  expect(baseInstance.objectValue.a).toEqual(123);
334
342
  });
335
343
 
@@ -339,7 +347,7 @@ describe('props tests', () => {
339
347
 
340
348
  test('correct custom field assignment', () => {
341
349
  madeFieldInstance.myField = 'replaced';
342
- // @ts-ignore
350
+ //@ts-ignore
343
351
  const initialValue = madeFieldInstance[SymbolInitialValue]('myField');
344
352
  expect(initialValue).toEqual('initial value');
345
353
  expect(secondMadeFieldInstance.myField).toEqual('replaced');
@@ -387,14 +395,13 @@ describe('props tests', () => {
387
395
  });
388
396
 
389
397
  test('correct custom missing prop search creation', () => {
390
- // @ts-ignore
398
+ //@ts-ignore
391
399
  expect(madeFieldInstance[Symbol.toStringTag]).toEqual(undefined);
392
- // @ts-ignore
400
+ //@ts-ignore
393
401
  expect(madeFieldInstance[Symbol.iterator]).toEqual(undefined);
394
402
  const util = require('util');
395
- // @ts-ignore
403
+ //@ts-ignore
396
404
  expect(madeFieldInstance[util.inspect.custom]).toEqual(undefined);
397
- // @ts-ignore
398
405
  const inspected = util.inspect(madeFieldInstance);
399
406
  const expected = 'MadeFieldClass { myField: [Getter/Setter] }';
400
407
  expect(inspected).toEqual(expected);
@@ -403,7 +410,7 @@ describe('props tests', () => {
403
410
  test('wrong assignment to objects', () => {
404
411
 
405
412
  expect(() => {
406
- // @ts-ignore
413
+ // @ts-expect-error
407
414
  baseInstance.objectValue = 123;
408
415
 
409
416
  }).toThrow(new TypeError('Type Mismatch'));
@@ -448,7 +455,7 @@ describe('props tests', () => {
448
455
 
449
456
  test('wrong assignment', () => {
450
457
  expect(() => {
451
- // @ts-ignore
458
+ // @ts-expect-error
452
459
  baseInstance.booleanValue = 123;
453
460
 
454
461
  }).toThrow(new TypeError('Type Mismatch'));
package/test/noJest.js ADDED
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
18
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
19
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
20
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
21
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
22
+ var _, done = false;
23
+ for (var i = decorators.length - 1; i >= 0; i--) {
24
+ var context = {};
25
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
26
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
27
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
28
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
29
+ if (kind === "accessor") {
30
+ if (result === void 0) continue;
31
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
32
+ if (_ = accept(result.get)) descriptor.get = _;
33
+ if (_ = accept(result.set)) descriptor.set = _;
34
+ if (_ = accept(result.init)) initializers.unshift(_);
35
+ }
36
+ else if (_ = accept(result)) {
37
+ if (kind === "field") initializers.unshift(_);
38
+ else descriptor[key] = _;
39
+ }
40
+ }
41
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
42
+ done = true;
43
+ };
44
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
45
+ var useValue = arguments.length > 2;
46
+ for (var i = 0; i < initializers.length; i++) {
47
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
48
+ }
49
+ return useValue ? value : void 0;
50
+ };
51
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
52
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
53
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
54
+ };
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ // BasePrototype & BaseClass are the same function
57
+ // go as you want for being meaningfull
58
+ // or meaningless
59
+ var BasePrototype = require('..');
60
+ var __1 = require("..");
61
+ // eslint-disable-next-line new-cap
62
+ var DecoratedByBase = function () {
63
+ var _classDecorators = [(0, __1.Strict)({ someProp: 123 })];
64
+ var _classDescriptor;
65
+ var _classExtraInitializers = [];
66
+ var _classThis;
67
+ var DecoratedByBase = _classThis = /** @class */ (function () {
68
+ function DecoratedByBase_1() {
69
+ }
70
+ return DecoratedByBase_1;
71
+ }());
72
+ __setFunctionName(_classThis, "DecoratedByBase");
73
+ (function () {
74
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
75
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
76
+ DecoratedByBase = _classThis = _classDescriptor.value;
77
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
78
+ __runInitializers(_classThis, _classExtraInitializers);
79
+ })();
80
+ return DecoratedByBase = _classThis;
81
+ }();
82
+ var ExtendedDecoratedByBase = /** @class */ (function (_super) {
83
+ __extends(ExtendedDecoratedByBase, _super);
84
+ function ExtendedDecoratedByBase() {
85
+ var _this = _super.call(this) || this;
86
+ _this.someProp = 321;
87
+ return _this;
88
+ }
89
+ return ExtendedDecoratedByBase;
90
+ }(DecoratedByBase));
91
+ // eslint-disable-next-line new-cap
92
+ var Base = /** @class */ (function (_super) {
93
+ __extends(Base, _super);
94
+ function Base() {
95
+ var _this = _super.call(this) || this;
96
+ _this.numberValue = 123;
97
+ debugger;
98
+ _this.stringValue = '123';
99
+ _this.booleanValue = true;
100
+ _this.objectValue = {};
101
+ return _this;
102
+ // ES2022
103
+ // Object.defineProperty(this, 'getterField', {
104
+ // get() {
105
+ // const answer = `${this.stringValue}`;
106
+ // return answer;
107
+ // }
108
+ // });
109
+ // Object.defineProperty(this, 'setterField', {
110
+ // set(value: string) {
111
+ // this.stringValue = value;
112
+ // }
113
+ // });
114
+ }
115
+ Object.defineProperty(Base.prototype, "getterField", {
116
+ get: function () {
117
+ var answer = "".concat(this.stringValue);
118
+ return answer;
119
+ },
120
+ enumerable: false,
121
+ configurable: true
122
+ });
123
+ Object.defineProperty(Base.prototype, "setterField", {
124
+ set: function (value) {
125
+ this.stringValue = value;
126
+ },
127
+ enumerable: false,
128
+ configurable: true
129
+ });
130
+ return Base;
131
+ }(BasePrototype({
132
+ additionalProp: 321,
133
+ someMethod: function () {
134
+ return this.numberValue.valueOf();
135
+ },
136
+ })));
137
+ debugger;
138
+ var baseInstance = new Base;
139
+ console.log(baseInstance);
140
+ debugger;
141
+ var upperInstance = Object.create(baseInstance);
142
+ console.log(upperInstance);
143
+ var SimpleBase = /** @class */ (function (_super) {
144
+ __extends(SimpleBase, _super);
145
+ function SimpleBase() {
146
+ var _this = _super !== null && _super.apply(this, arguments) || this;
147
+ _this.stringProp = '123';
148
+ return _this;
149
+ // ES2022
150
+ // stringProp: string;
151
+ // constructor() {
152
+ // super();
153
+ // this.stringProp = '123';
154
+ // }
155
+ }
156
+ return SimpleBase;
157
+ }(__1.BaseClass));
158
+ debugger;
159
+ var simpleInstance = new SimpleBase;
160
+ console.log(simpleInstance);
161
+ debugger;
162
+ var decorated = new DecoratedByBase;
163
+ console.log(decorated);
164
+ debugger;
165
+ var exdecorated = new ExtendedDecoratedByBase;
166
+ console.log(exdecorated);
167
+ debugger;
package/test/noJest.ts ADDED
@@ -0,0 +1,105 @@
1
+
2
+ // BasePrototype & BaseClass are the same function
3
+ // go as you want for being meaningfull
4
+ // or meaningless
5
+ const BasePrototype = require('..');
6
+ import { BaseClass, Strict } from '..';
7
+
8
+ interface IBase {
9
+ get getterField(): string
10
+ // eslint-disable-next-line no-unused-vars
11
+ set setterField(value: string)
12
+ numberValue: number
13
+ stringValue: string
14
+ booleanValue: boolean
15
+ objectValue: object
16
+ }
17
+
18
+
19
+
20
+ // eslint-disable-next-line new-cap
21
+ @Strict({ someProp: 123 })
22
+ class DecoratedByBase {
23
+ someProp!: number;
24
+ }
25
+
26
+ class ExtendedDecoratedByBase extends DecoratedByBase {
27
+ someProp: number;
28
+ constructor() {
29
+ super();
30
+ this.someProp = 321;
31
+ }
32
+ }
33
+
34
+ // eslint-disable-next-line new-cap
35
+ class Base extends BasePrototype({
36
+ additionalProp: 321,
37
+ someMethod() {
38
+ return this.numberValue.valueOf();
39
+ },
40
+ }) implements IBase {
41
+ numberValue = 123;
42
+ stringValue: string;
43
+ booleanValue: boolean;
44
+ objectValue: object;
45
+
46
+ get getterField() {
47
+ const answer = `${this.stringValue}`;
48
+ return answer;
49
+ }
50
+
51
+ set setterField(value: string) {
52
+ this.stringValue = value;
53
+ }
54
+
55
+ constructor() {
56
+ super();
57
+ debugger;
58
+ this.stringValue = '123';
59
+ this.booleanValue = true;
60
+ this.objectValue = {};
61
+ // ES2022
62
+ // Object.defineProperty(this, 'getterField', {
63
+ // get() {
64
+ // const answer = `${this.stringValue}`;
65
+ // return answer;
66
+ // }
67
+ // });
68
+ // Object.defineProperty(this, 'setterField', {
69
+ // set(value: string) {
70
+ // this.stringValue = value;
71
+ // }
72
+ // });
73
+ }
74
+ }
75
+ debugger;
76
+ const baseInstance = new Base;
77
+ console.log(baseInstance);
78
+ debugger;
79
+
80
+ const upperInstance = Object.create(baseInstance);
81
+ console.log(upperInstance);
82
+
83
+ class SimpleBase extends BaseClass {
84
+ stringProp = '123';
85
+ // ES2022
86
+ // stringProp: string;
87
+ // constructor() {
88
+ // super();
89
+ // this.stringProp = '123';
90
+ // }
91
+ }
92
+
93
+ debugger;
94
+ const simpleInstance = new SimpleBase;
95
+ console.log(simpleInstance);
96
+
97
+ debugger;
98
+ const decorated = new DecoratedByBase;
99
+ console.log(decorated);
100
+
101
+ debugger;
102
+ const exdecorated = new ExtendedDecoratedByBase;
103
+ console.log(exdecorated);
104
+
105
+ debugger;
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "ES2015",
5
- "lib": [
6
- "ES6",
7
- ],
4
+ "target": "es2023",
8
5
  "strict": true,
9
6
  "alwaysStrict": true,
10
7
  "strictFunctionTypes": true,
package/tsconfig.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "module": "commonjs",
4
- "target": "ES2015",
5
- "lib": [
6
- "ES6",
7
- ],
4
+ "target": "es6",
8
5
  "strict": true,
9
6
  "alwaysStrict": true,
10
7
  "strictFunctionTypes": true,
@@ -16,7 +13,7 @@
16
13
  "noUnusedLocals": true,
17
14
  "noUnusedParameters": true,
18
15
  "declaration": true,
19
- "sourceMap": false,
16
+ "sourceMap": true,
20
17
  "outDir": "lib",
21
18
  "traceResolution": false,
22
19
  "removeComments": true,