typeomatica 0.3.38 → 0.3.55
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/lib/errors.js +1 -1
- package/lib/fields.js +1 -1
- package/lib/index.d.ts +8 -8
- package/lib/index.js +127 -35
- package/lib/types/functions.js +1 -1
- package/lib/types/index.js +1 -1
- package/lib/types/nullish.js +1 -1
- package/lib/types/objects.js +1 -1
- package/lib/types/primitives.js +1 -1
- package/lib/types/special.js +1 -1
- package/package.json +38 -19
- package/.editorconfig +0 -11
- package/.eslintignore +0 -0
- package/.eslintrc.js +0 -72
- package/.gitattributes +0 -22
- package/.github/workflows/node.js.yml +0 -62
- package/.husky/pre-commit +0 -4
- package/jest.config.js +0 -11
- package/lib/errors.js.map +0 -1
- package/lib/fields.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types/functions.js.map +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/types/nullish.js.map +0 -1
- package/lib/types/objects.js.map +0 -1
- package/lib/types/primitives.js.map +0 -1
- package/lib/types/special.js.map +0 -1
- package/src/errors.ts +0 -9
- package/src/fields.ts +0 -76
- package/src/index.ts +0 -297
- package/src/types/functions.ts +0 -7
- package/src/types/index.ts +0 -17
- package/src/types/nullish.ts +0 -15
- package/src/types/objects.ts +0 -19
- package/src/types/primitives.ts +0 -69
- package/src/types/special.ts +0 -19
- package/test/__snapshots__/index.ts.snap +0 -3
- package/test/addition.js +0 -49
- package/test/index.ts +0 -690
- package/test/noJest.js +0 -167
- package/test/noJest.ts +0 -105
- package/tsconfig.jest.json +0 -35
- package/tsconfig.json +0 -31
package/test/noJest.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
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;
|
package/tsconfig.jest.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"target": "es2023",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"alwaysStrict": true,
|
|
7
|
-
"strictFunctionTypes": true,
|
|
8
|
-
"diagnostics": true,
|
|
9
|
-
"noImplicitThis": true,
|
|
10
|
-
"extendedDiagnostics": true,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"noFallthroughCasesInSwitch": true,
|
|
13
|
-
"noUnusedLocals": true,
|
|
14
|
-
"noUnusedParameters": true,
|
|
15
|
-
"declaration": true,
|
|
16
|
-
"sourceMap": false,
|
|
17
|
-
"outDir": "lib",
|
|
18
|
-
"traceResolution": false,
|
|
19
|
-
"removeComments": true,
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": true,
|
|
22
|
-
"types": [
|
|
23
|
-
"jest",
|
|
24
|
-
"node"
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"include": [
|
|
28
|
-
"./test/**/*.ts"
|
|
29
|
-
],
|
|
30
|
-
"exclude": [
|
|
31
|
-
"./lib/**/*",
|
|
32
|
-
"./coverage/**/*",
|
|
33
|
-
"./node_modules/**/*",
|
|
34
|
-
]
|
|
35
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"target": "es6",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"alwaysStrict": true,
|
|
7
|
-
"strictFunctionTypes": true,
|
|
8
|
-
"diagnostics": true,
|
|
9
|
-
"noImplicitThis": true,
|
|
10
|
-
"extendedDiagnostics": true,
|
|
11
|
-
"noImplicitReturns": true,
|
|
12
|
-
"noFallthroughCasesInSwitch": true,
|
|
13
|
-
"noUnusedLocals": true,
|
|
14
|
-
"noUnusedParameters": true,
|
|
15
|
-
"declaration": true,
|
|
16
|
-
"sourceMap": true,
|
|
17
|
-
"outDir": "lib",
|
|
18
|
-
"traceResolution": false,
|
|
19
|
-
"removeComments": true,
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"forceConsistentCasingInFileNames": true,
|
|
22
|
-
"types": ["node"]
|
|
23
|
-
},
|
|
24
|
-
"include": [
|
|
25
|
-
"./src/**/*.ts",
|
|
26
|
-
],
|
|
27
|
-
"exclude": [
|
|
28
|
-
"./lib/**/*",
|
|
29
|
-
"./coverage/**/*",
|
|
30
|
-
]
|
|
31
|
-
}
|