gen-api-types 1.0.8 → 1.0.9
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.en.md +4 -0
- package/README.md +4 -0
- package/package.json +5 -1
- package/src/argv/index.ts +1 -1
- package/src/constant/index.ts +2 -0
- package/src/decotators/index.ts +0 -1
- package/src/index.ts +1 -0
- package/tsconfig.json +2 -2
package/README.en.md
CHANGED
|
@@ -51,6 +51,10 @@ As shown in the code above:
|
|
|
51
51
|
1. `typeName: string` Interface return type name. If not specified, the default name will be: `Response_${ClassName}_${MethodName}`
|
|
52
52
|
2. `args: any[]` Method parameter list. The tool will pass this list when calling the request method.
|
|
53
53
|
|
|
54
|
+
> Note:
|
|
55
|
+
|
|
56
|
+
If TypeScript reports the decorator error: "The runtime will invoke the decorator with 2 arguments, but the decorator expects 3", set `compilerOptions.experimentalDecorators` to `true` in tsconfig.
|
|
57
|
+
|
|
54
58
|
##### 2. Execute command
|
|
55
59
|
|
|
56
60
|
```shell
|
package/README.md
CHANGED
|
@@ -52,6 +52,10 @@ export class TestApi {
|
|
|
52
52
|
1. `typeName: string` 接口返回类型名称,若不指定该字段,默认生成名称为: `Response_${类名}_${方法名}`
|
|
53
53
|
2. `args:any[] ` 方法参数列表,工具调用请求方法时,会将参数列表传入
|
|
54
54
|
|
|
55
|
+
> 注意:
|
|
56
|
+
|
|
57
|
+
若使用装饰器时ts报错: "运行时将使用 2 个自变量调用修饰器,但修饰器需要 3 个",请将tsconfig中`compilerOptions.experimentalDecorators`设置为`true`
|
|
58
|
+
|
|
55
59
|
##### 2. 执行命令
|
|
56
60
|
|
|
57
61
|
```shell
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gen-api-types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "一个自动生成请求接口返回类型的 cli 小工具",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"type": "module",
|
|
6
10
|
"bin": {
|
|
7
11
|
"gen-api-types": "bin/index.js",
|
|
8
12
|
"gat": "bin/index.js"
|
package/src/argv/index.ts
CHANGED
package/src/constant/index.ts
CHANGED
package/src/decotators/index.ts
CHANGED
package/src/index.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"exclude": [],
|
|
3
|
-
"include": ["src", "test"],
|
|
3
|
+
"include": ["src", "test"], //把这些源码/声明文件加入项目
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
6
|
-
"types": ["node"],
|
|
6
|
+
"types": ["node"], //它主要用来控制自动引入哪些 @types 包 或类型包
|
|
7
7
|
/* Projects */
|
|
8
8
|
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
9
9
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|