Skip to content

Commit 0d2ac27

Browse files
perf: perf parmas customTemplates type definition
1 parent 97baffc commit 0d2ac27

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

.changeset/spicy-insects-eat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'openapi-ts-request': patch
3+
---
4+
5+
perf: perf parmas customTemplates type definition

src/index.ts

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PriorityRule, ReactQueryMode } from './config';
44
import type { TypescriptFileType } from './generator/config';
55
import { mockGenerator } from './generator/mockGenarator';
66
import ServiceGenerator from './generator/serviceGenarator';
7-
import type { APIDataType } from './generator/type';
7+
import type { APIDataType, ITypeItem } from './generator/type';
88
import type {
99
ComponentsObject,
1010
IPriorityRule,
@@ -239,27 +239,26 @@ export type GenerateServiceProps = {
239239
*/
240240
customTemplates?: {
241241
/**
242-
* 自定义 displayTypeLabel 模板
242+
* 自定义 serviceController 模板
243243
*/
244-
[TypescriptFileType.displayTypeLabel]?: <T, U>(
245-
types: T[],
246-
config: U
244+
[TypescriptFileType.serviceController]?: <T, U>(
245+
item: T,
246+
context: U
247247
) => string;
248248
/**
249249
* 自定义 displayEnumLabel 模板
250250
*/
251251
[TypescriptFileType.displayEnumLabel]?: <T, U>(
252252
enums: T[],
253253
config: U
254-
) => string;
255-
254+
) => ITypeItem[];
256255
/**
257-
* 自定义 serviceController 模板
256+
* 自定义 displayTypeLabel 模板
258257
*/
259-
[TypescriptFileType.serviceController]?: <T, U>(
260-
item: T,
261-
context: U
262-
) => string;
258+
[TypescriptFileType.displayTypeLabel]?: <T, U>(
259+
types: T[],
260+
config: U
261+
) => ITypeItem[];
263262
};
264263
};
265264
};

0 commit comments

Comments
 (0)