Skip to content

Commit 700ebae

Browse files
authored
Merge pull request #812 from acacode/fix-types
Fix types
2 parents 8f955d5 + c8ce5df commit 700ebae

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,25 @@
1414
"exports": {
1515
".": {
1616
"import": {
17-
"types": "./index.d.ts",
17+
"types": "./dist/types.d.ts",
1818
"default": "./dist/lib.js"
1919
},
2020
"require": {
21-
"types": "./index.d.ts",
21+
"types": "./dist/types.d.cts",
2222
"default": "./dist/lib.cjs"
2323
}
2424
}
2525
},
2626
"main": "./dist/lib.cjs",
2727
"module": "./dist/lib.js",
28-
"types": "./index.d.ts",
28+
"types": "./dist/index.d.cts",
2929
"bin": {
3030
"sta": "./dist/cli.js",
3131
"swagger-typescript-api": "./dist/cli.js"
3232
},
3333
"files": [
3434
"dist",
35-
"templates",
36-
"index.d.ts"
35+
"templates"
3736
],
3837
"scripts": {
3938
"build": "tsup",

tsup.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ export default defineConfig({
66
cli: "index.js",
77
},
88
clean: true,
9+
dts: {
10+
entry: {
11+
types: "types/index.d.ts",
12+
},
13+
},
914
format: ["esm", "cjs"],
1015
minify: true,
1116
sourcemap: true,

index.d.ts renamed to types/index.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { MonoSchemaParser } from "./src/schema-parser/mono-schema-parser";
1+
import type { MonoSchemaParser } from "../src/schema-parser/mono-schema-parser";
22

33
type HttpClientType = "axios" | "fetch";
44

@@ -212,7 +212,7 @@ interface GenerateApiParamsBase {
212212
* }
213213
* ```
214214
*/
215-
customTranslator?: new () => typeof import("./src/translators/translator").Translator;
215+
customTranslator?: new () => typeof import("../src/translators/translator").Translator;
216216
/** fallback name for enum key resolver */
217217
enumKeyResolverName?: string;
218218
/** fallback name for type name resolver */
@@ -279,7 +279,7 @@ type PrimitiveTypeStructValue =
279279
| string
280280
| ((
281281
schema: Record<string, any>,
282-
parser: import("./src/schema-parser/schema-parser").SchemaParser,
282+
parser: import("../src/schema-parser/schema-parser").SchemaParser,
283283
) => string);
284284

285285
type PrimitiveTypeStruct = Record<
@@ -366,7 +366,7 @@ export interface Hooks {
366366
/** Start point of work this tool (after fetching schema) */
367367
onInit?: <C extends GenerateApiConfiguration["config"]>(
368368
configuration: C,
369-
codeGenProcess: import("./src/code-gen-process").CodeGenProcess,
369+
codeGenProcess: import("../src/code-gen-process").CodeGenProcess,
370370
) => C | void;
371371
/** customize configuration object before sending it to ETA templates */
372372
onPrepareConfig?: <C extends GenerateApiConfiguration>(
@@ -657,11 +657,11 @@ export interface GenerateApiConfiguration {
657657
/** do not use constructor args, it can break functionality of this property, just send class reference */
658658
customTranslator?: new (
659659
...args: never[]
660-
) => typeof import("./src/translators/translator").Translator;
660+
) => typeof import("../src/translators/translator").Translator;
661661
internalTemplateOptions: {
662662
addUtilRequiredKeysType: boolean;
663663
};
664-
componentTypeNameResolver: typeof import("./src/component-type-name-resolver").ComponentTypeNameResolver;
664+
componentTypeNameResolver: typeof import("../src/component-type-name-resolver").ComponentTypeNameResolver;
665665
fileNames: {
666666
dataContracts: string;
667667
routeTypes: string;
@@ -754,7 +754,7 @@ export interface GenerateApiOutput {
754754
renderTemplate: (
755755
templateContent: string,
756756
data: Record<string, unknown>,
757-
etaOptions?: import("eta/dist/types/config").PartialConfig,
757+
etaOptions?: Partial<import("eta").EtaConfig>,
758758
) => string;
759759
getTemplate: (params: {
760760
fileName?: string;

0 commit comments

Comments
 (0)