@zwa73/utils 1.0.62 → 1.0.63
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/UtilInterfaces.d.ts
CHANGED
|
@@ -99,5 +99,5 @@ export type MethodsThisAs<Methods, T> = {
|
|
|
99
99
|
* @template T - 目标this类型
|
|
100
100
|
* @param prototype - 类的原型
|
|
101
101
|
*/
|
|
102
|
-
export declare function
|
|
102
|
+
export declare function assertThisAs<Self, T>(prototype: MethodsThisAs<Self, T>): void;
|
|
103
103
|
export {};
|
package/dist/UtilInterfaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.assertThisAs = exports.stringifyJToken = void 0;
|
|
4
4
|
/**将JToken转换为字符串
|
|
5
5
|
* @param token - 待转换的Token
|
|
6
6
|
* @param space - 插入的空格 数字为空格数量 默认为制表符\t
|
|
@@ -19,5 +19,5 @@ exports.stringifyJToken = stringifyJToken;
|
|
|
19
19
|
* @template T - 目标this类型
|
|
20
20
|
* @param prototype - 类的原型
|
|
21
21
|
*/
|
|
22
|
-
function
|
|
23
|
-
exports.
|
|
22
|
+
function assertThisAs(prototype) { }
|
|
23
|
+
exports.assertThisAs = assertThisAs;
|
package/dist/test/composeTest.js
CHANGED
package/package.json
CHANGED
package/src/UtilInterfaces.ts
CHANGED
|
@@ -155,4 +155,4 @@ export type MethodsThisAs<Methods, T> = {
|
|
|
155
155
|
* @template T - 目标this类型
|
|
156
156
|
* @param prototype - 类的原型
|
|
157
157
|
*/
|
|
158
|
-
export function
|
|
158
|
+
export function assertThisAs<Self,T>(prototype: MethodsThisAs<Self, T>) {}
|
package/src/test/composeTest.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UtilFP, UtilFunc,
|
|
1
|
+
import { UtilFP, UtilFunc, assertThisAs } from ".."
|
|
2
2
|
|
|
3
3
|
class A {
|
|
4
4
|
private num = 1;
|
|
@@ -39,7 +39,7 @@ function composeC(obj:_C){
|
|
|
39
39
|
}
|
|
40
40
|
export type C = ReturnType<typeof composeC>;
|
|
41
41
|
export const C = _C;
|
|
42
|
-
|
|
42
|
+
assertThisAs<_C,C>(C.prototype);
|
|
43
43
|
|
|
44
44
|
const insc:C=C.create();//?
|
|
45
45
|
insc.getC().testFunc()//?
|