@lsby/ts-type-func 0.0.3 → 0.1.0

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # ts-type-func
2
+
3
+ 一个 TypeScript 类型级计算和操作的工具库。
@@ -14,8 +14,5 @@ var __copyProps = (to, from, except, desc) => {
14
14
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
15
 
16
16
  // src/index.ts
17
- var src_exports = {};
18
- module.exports = __toCommonJS(src_exports);
19
-
20
- // src/通用/错误.ts
21
- var __ERROR__ = Symbol();
17
+ var index_exports = {};
18
+ module.exports = __toCommonJS(index_exports);
@@ -1,6 +1,7 @@
1
1
  export { 生成json } from './json/生成json.cjs';
2
2
  export { 解析json } from './json/解析json.cjs';
3
3
  export { 计算函数类型 } from './函数操作/计算函数类型.cjs';
4
+ export { 计算函数所有重载 } from './函数操作/计算函数所有重载.cjs';
4
5
  export { 反转字符串 } from './字符串操作/反转字符串.cjs';
5
6
  export { 字符串以某值开头 } from './字符串操作/字符串以某值开头.cjs';
6
7
  export { 删除对象指定键 } from './对象操作/删除对象指定键.cjs';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/函数操作/计算函数所有重载.ts
17
+ var __exports = {};
18
+ module.exports = __toCommonJS(__exports);
@@ -0,0 +1,26 @@
1
+ type 匹配重载<T> = T extends {
2
+ (...a: infer A1): infer R1;
3
+ (...a: infer A2): infer R2;
4
+ (...a: infer A3): infer R3;
5
+ (...a: infer A4): infer R4;
6
+ (...a: infer A5): infer R5;
7
+ (...a: infer A6): infer R6;
8
+ (...a: infer A7): infer R7;
9
+ (...a: infer A8): infer R8;
10
+ (...a: infer A9): infer R9;
11
+ } ? [
12
+ (...a: A1) => R1,
13
+ (...a: A2) => R2,
14
+ (...a: A3) => R3,
15
+ (...a: A4) => R4,
16
+ (...a: A5) => R5,
17
+ (...a: A6) => R6,
18
+ (...a: A6) => R6,
19
+ (...a: A7) => R7,
20
+ (...a: A8) => R8,
21
+ (...a: A9) => R9
22
+ ] : never;
23
+ type 删除重复<T extends any[]> = T extends [infer x, ...infer xs] ? x extends xs[number] ? 删除重复<xs> : [x, ...删除重复<xs>] : [];
24
+ type 计算函数所有重载<T> = 删除重复<匹配重载<T>>;
25
+
26
+ export type { 计算函数所有重载 };
@@ -16,4 +16,3 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // src/通用/错误.ts
17
17
  var __exports = {};
18
18
  module.exports = __toCommonJS(__exports);
19
- var __ERROR__ = Symbol();
File without changes
File without changes
@@ -1,6 +1,7 @@
1
1
  export { 生成json } from './json/生成json.js';
2
2
  export { 解析json } from './json/解析json.js';
3
3
  export { 计算函数类型 } from './函数操作/计算函数类型.js';
4
+ export { 计算函数所有重载 } from './函数操作/计算函数所有重载.js';
4
5
  export { 反转字符串 } from './字符串操作/反转字符串.js';
5
6
  export { 字符串以某值开头 } from './字符串操作/字符串以某值开头.js';
6
7
  export { 删除对象指定键 } from './对象操作/删除对象指定键.js';
package/dist/esm/index.js CHANGED
@@ -1,8 +1,10 @@
1
+ import "./chunk-B2YHH34W.js";
1
2
  import "./chunk-V5VP4N2G.js";
2
- import "./chunk-TOOGWA2T.js";
3
+ import "./chunk-4Y56TSNW.js";
3
4
  import "./chunk-FKP5ICSV.js";
4
5
  import "./chunk-4E35PVUF.js";
5
6
  import "./chunk-F74DYXQB.js";
7
+ import "./chunk-PMM72XWL.js";
6
8
  import "./chunk-KNLEAIQH.js";
7
9
  import "./chunk-TCXXDDOT.js";
8
10
  import "./chunk-NZMAEG5T.js";
@@ -10,35 +12,34 @@ import "./chunk-A4UNMM7V.js";
10
12
  import "./chunk-YHW43ZXY.js";
11
13
  import "./chunk-37MHWKRY.js";
12
14
  import "./chunk-HLWPWPVJ.js";
13
- import "./chunk-B2YHH34W.js";
14
- import "./chunk-CZPHCQKU.js";
15
- import "./chunk-BBK4A5K5.js";
16
15
  import "./chunk-GT7WSXQ5.js";
17
16
  import "./chunk-QG637PCL.js";
18
17
  import "./chunk-MLZTL37Q.js";
18
+ import "./chunk-ITQ2KRT3.js";
19
+ import "./chunk-CP3ICRUS.js";
20
+ import "./chunk-IRN3OJWQ.js";
19
21
  import "./chunk-C77SD44C.js";
20
22
  import "./chunk-LFQH6SGO.js";
21
- import "./chunk-PMM72XWL.js";
22
- import "./chunk-5WUPFMVC.js";
23
- import "./chunk-LAF7ORG3.js";
24
23
  import "./chunk-7GOKWI2T.js";
25
24
  import "./chunk-ZV76NFM7.js";
26
25
  import "./chunk-H7ZSCAR2.js";
27
26
  import "./chunk-JLCC5GB5.js";
28
27
  import "./chunk-7CCKMLKT.js";
29
28
  import "./chunk-OHZGAWDS.js";
30
- import "./chunk-CP3ICRUS.js";
31
- import "./chunk-IRN3OJWQ.js";
29
+ import "./chunk-CZPHCQKU.js";
30
+ import "./chunk-BBK4A5K5.js";
32
31
  import "./chunk-NPXFT2D5.js";
33
32
  import "./chunk-RY36F3TN.js";
34
33
  import "./chunk-MWZVQW5R.js";
35
34
  import "./chunk-CSZ62WT3.js";
36
35
  import "./chunk-GGI56HN7.js";
37
36
  import "./chunk-H4MWVIW5.js";
37
+ import "./chunk-5WUPFMVC.js";
38
+ import "./chunk-LAF7ORG3.js";
38
39
  import "./chunk-GPDJ2DHB.js";
39
40
  import "./chunk-EMHOQO5R.js";
40
41
  import "./chunk-QV6OAMJJ.js";
41
42
  import "./chunk-GYWB4NCZ.js";
42
43
  import "./chunk-3AEEFP6T.js";
44
+ import "./chunk-F3OGFDR7.js";
43
45
  import "./chunk-XNUWQGRN.js";
44
- import "./chunk-ITQ2KRT3.js";
@@ -0,0 +1,26 @@
1
+ type 匹配重载<T> = T extends {
2
+ (...a: infer A1): infer R1;
3
+ (...a: infer A2): infer R2;
4
+ (...a: infer A3): infer R3;
5
+ (...a: infer A4): infer R4;
6
+ (...a: infer A5): infer R5;
7
+ (...a: infer A6): infer R6;
8
+ (...a: infer A7): infer R7;
9
+ (...a: infer A8): infer R8;
10
+ (...a: infer A9): infer R9;
11
+ } ? [
12
+ (...a: A1) => R1,
13
+ (...a: A2) => R2,
14
+ (...a: A3) => R3,
15
+ (...a: A4) => R4,
16
+ (...a: A5) => R5,
17
+ (...a: A6) => R6,
18
+ (...a: A6) => R6,
19
+ (...a: A7) => R7,
20
+ (...a: A8) => R8,
21
+ (...a: A9) => R9
22
+ ] : never;
23
+ type 删除重复<T extends any[]> = T extends [infer x, ...infer xs] ? x extends xs[number] ? 删除重复<xs> : [x, ...删除重复<xs>] : [];
24
+ type 计算函数所有重载<T> = 删除重复<匹配重载<T>>;
25
+
26
+ export type { 计算函数所有重载 };
@@ -1 +1 @@
1
- import "../chunk-TOOGWA2T.js";
1
+ import "../chunk-4Y56TSNW.js";
package/package.json CHANGED
@@ -1,40 +1,44 @@
1
- {
2
- "name": "@lsby/ts-type-func",
3
- "version": "0.0.3",
4
- "type": "module",
5
- "exports": {
6
- "require": "./dist/cjs/index.cjs",
7
- "import": "./dist/esm/index.js"
8
- },
9
- "files": [
10
- "dist"
11
- ],
12
- "scripts": {
13
- "build:all": "npm run build:cjs && npm run build:esm",
14
- "build:cjs": "tsup src/**/*.ts --format cjs --clean --dts -d dist/cjs",
15
- "build:esm": "tsup src/**/*.ts --format esm --clean --dts -d dist/esm",
16
- "check:all": "npm run check:format && npm run check:lint && npm run check:type",
17
- "check:format": "prettier --write .",
18
- "check:lint": "eslint . --fix",
19
- "check:type": "tsc --noEmit",
20
- "check:type:watch": "tsc --noEmit -w",
21
- "pub:public": "npm run check:all && npm run test:base && npm run build:all && bumpp && npm publish --access public",
22
- "test:base": "npm run check:all && vitest run",
23
- "test:coverage": "npm run check:all && vitest run --coverage && open-cli ./coverage/index.html"
24
- },
25
- "dependencies": {
26
- "vitest": "^2.0.2"
27
- },
28
- "devDependencies": {
29
- "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
30
- "@lsby/eslint-config": "^0.0.2",
31
- "@types/node": "^20.12.10",
32
- "@vitest/coverage-v8": "^2.0.2",
33
- "bumpp": "^9.4.1",
34
- "open-cli": "^8.0.0",
35
- "prettier": "3.2.5",
36
- "prettier-plugin-packagejson": "^2.5.0",
37
- "tsup": "^8.0.2",
38
- "typescript": "^5.4.5"
39
- }
1
+ {
2
+ "name": "@lsby/ts-type-func",
3
+ "version": "0.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/lsby/ts-type-func.git"
7
+ },
8
+ "type": "module",
9
+ "exports": {
10
+ "require": "./dist/cjs/index.cjs",
11
+ "import": "./dist/esm/index.js"
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "scripts": {
17
+ "build:all": "npm run build:cjs && npm run build:esm",
18
+ "build:cjs": "tsup src/**/*.ts --format cjs --clean --dts -d dist/cjs",
19
+ "build:esm": "tsup src/**/*.ts --format esm --clean --dts -d dist/esm",
20
+ "check:all": "npm run check:format && npm run check:lint && npm run check:type",
21
+ "check:format": "prettier --write .",
22
+ "check:lint": "eslint . --fix",
23
+ "check:type": "tsc --noEmit",
24
+ "check:type:watch": "tsc --noEmit -w",
25
+ "pub:public": "npm run check:all && npm run test:base && npm run build:all && bumpp && npm publish --access public",
26
+ "test:base": "npm run check:all && vitest run",
27
+ "test:coverage": "npm run check:all && vitest run --coverage && open-cli ./coverage/index.html"
28
+ },
29
+ "dependencies": {
30
+ "vitest": "^2.0.2"
31
+ },
32
+ "devDependencies": {
33
+ "@ianvs/prettier-plugin-sort-imports": "^4.2.1",
34
+ "@lsby/eslint-config": "^0.1.0",
35
+ "@types/node": "^20.12.10",
36
+ "@vitest/coverage-v8": "^2.0.2",
37
+ "bumpp": "^9.4.1",
38
+ "open-cli": "^8.0.0",
39
+ "prettier": "3.2.5",
40
+ "prettier-plugin-packagejson": "^2.5.0",
41
+ "tsup": "^8.0.2",
42
+ "typescript": "^5.4.5"
43
+ }
40
44
  }
@@ -1,2 +0,0 @@
1
- // src/通用/错误.ts
2
- var __ERROR__ = Symbol();