typeomatica 0.3.32 → 0.3.33
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/index.d.ts +4 -0
- package/lib/index.js +10 -1
- package/package.json +1 -1
- package/src/index.ts +26 -0
- package/test/index.ts +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -6,3 +6,7 @@ export declare const BaseConstructorPrototype: <P extends object, S extends Prot
|
|
|
6
6
|
export declare class BaseClass extends BaseConstructorPrototype {
|
|
7
7
|
}
|
|
8
8
|
export { FieldConstructor } from './fields';
|
|
9
|
+
type StrictRuntime = {
|
|
10
|
+
<T extends object>(...args: unknown[]): T;
|
|
11
|
+
};
|
|
12
|
+
export declare const Strict: StrictRuntime;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FieldConstructor = exports.BaseClass = exports.BaseConstructorPrototype = void 0;
|
|
3
|
+
exports.Strict = exports.FieldConstructor = exports.BaseClass = exports.BaseConstructorPrototype = void 0;
|
|
4
4
|
const errors_1 = require("./errors");
|
|
5
5
|
const types_1 = require("./types");
|
|
6
6
|
const fields_1 = require("./fields");
|
|
@@ -107,6 +107,9 @@ class BaseClass extends exports.BaseConstructorPrototype {
|
|
|
107
107
|
exports.BaseClass = BaseClass;
|
|
108
108
|
var fields_2 = require("./fields");
|
|
109
109
|
Object.defineProperty(exports, "FieldConstructor", { enumerable: true, get: function () { return fields_2.FieldConstructor; } });
|
|
110
|
+
exports.Strict = {
|
|
111
|
+
Strict: exports.BaseConstructorPrototype,
|
|
112
|
+
}.Strict;
|
|
110
113
|
Object.defineProperty(module.exports, 'BaseClass', {
|
|
111
114
|
get() {
|
|
112
115
|
return BaseClass;
|
|
@@ -119,3 +122,9 @@ Object.defineProperty(module.exports, 'FieldConstructor', {
|
|
|
119
122
|
},
|
|
120
123
|
enumerable: true
|
|
121
124
|
});
|
|
125
|
+
Object.defineProperty(module.exports, 'Strict', {
|
|
126
|
+
get() {
|
|
127
|
+
return exports.BaseConstructorPrototype;
|
|
128
|
+
},
|
|
129
|
+
enumerable: true
|
|
130
|
+
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -194,6 +194,20 @@ Object.defineProperty(module, 'exports', {
|
|
|
194
194
|
export class BaseClass extends BaseConstructorPrototype { }
|
|
195
195
|
export { FieldConstructor } from './fields';
|
|
196
196
|
|
|
197
|
+
type StrictRuntime = {
|
|
198
|
+
// eslint-disable-next-line no-unused-vars
|
|
199
|
+
<T extends object>(...args: unknown[]): T
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// export const { StrictPrototype, Strict } = {
|
|
203
|
+
export const { Strict } = {
|
|
204
|
+
// StrictPrototype: BaseConstructorPrototype,
|
|
205
|
+
Strict: BaseConstructorPrototype,
|
|
206
|
+
} as {
|
|
207
|
+
// StrictPrototype: StrictRuntime
|
|
208
|
+
Strict: StrictRuntime
|
|
209
|
+
};
|
|
210
|
+
|
|
197
211
|
Object.defineProperty(module.exports, 'BaseClass', {
|
|
198
212
|
get() {
|
|
199
213
|
return BaseClass;
|
|
@@ -206,3 +220,15 @@ Object.defineProperty(module.exports, 'FieldConstructor', {
|
|
|
206
220
|
},
|
|
207
221
|
enumerable: true
|
|
208
222
|
});
|
|
223
|
+
// Object.defineProperty(module.exports, 'StrictPrototype', {
|
|
224
|
+
// get() {
|
|
225
|
+
// return BaseConstructorPrototype;
|
|
226
|
+
// },
|
|
227
|
+
// enumerable: true
|
|
228
|
+
// });
|
|
229
|
+
Object.defineProperty(module.exports, 'Strict', {
|
|
230
|
+
get() {
|
|
231
|
+
return BaseConstructorPrototype;
|
|
232
|
+
},
|
|
233
|
+
enumerable: true
|
|
234
|
+
});
|
package/test/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { describe, expect, test } from '@jest/globals';
|
|
|
6
6
|
// go as you want for being meaningfull
|
|
7
7
|
// or meaningless
|
|
8
8
|
const BasePrototype = require('..');
|
|
9
|
-
import { BaseClass, FieldConstructor } from '..';
|
|
9
|
+
import { BaseClass, FieldConstructor, Strict } from '..';
|
|
10
10
|
|
|
11
11
|
const { SymbolInitialValue } = FieldConstructor;
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ let decoratedSomeProp = 0;
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
// eslint-disable-next-line new-cap
|
|
29
|
-
@
|
|
29
|
+
@Strict({ someProp: 123 })
|
|
30
30
|
class DecoratedByBase {
|
|
31
31
|
someProp!: number;
|
|
32
32
|
}
|