Skip to content

Commit

Permalink
Merge pull request #812 from acacode/fix-types
Browse files Browse the repository at this point in the history
Fix types
  • Loading branch information
smorimoto committed Jun 30, 2024
2 parents 8f955d5 + c8ce5df commit 700ebae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,25 @@
"exports": {
".": {
"import": {
"types": "./index.d.ts",
"types": "./dist/types.d.ts",
"default": "./dist/lib.js"
},
"require": {
"types": "./index.d.ts",
"types": "./dist/types.d.cts",
"default": "./dist/lib.cjs"
}
}
},
"main": "./dist/lib.cjs",
"module": "./dist/lib.js",
"types": "./index.d.ts",
"types": "./dist/index.d.cts",
"bin": {
"sta": "./dist/cli.js",
"swagger-typescript-api": "./dist/cli.js"
},
"files": [
"dist",
"templates",
"index.d.ts"
"templates"
],
"scripts": {
"build": "tsup",
Expand Down
5 changes: 5 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ export default defineConfig({
cli: "index.js",
},
clean: true,
dts: {
entry: {
types: "types/index.d.ts",
},
},
format: ["esm", "cjs"],
minify: true,
sourcemap: true,
Expand Down
14 changes: 7 additions & 7 deletions index.d.ts → types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MonoSchemaParser } from "./src/schema-parser/mono-schema-parser";
import type { MonoSchemaParser } from "../src/schema-parser/mono-schema-parser";

type HttpClientType = "axios" | "fetch";

Expand Down Expand Up @@ -212,7 +212,7 @@ interface GenerateApiParamsBase {
* }
* ```
*/
customTranslator?: new () => typeof import("./src/translators/translator").Translator;
customTranslator?: new () => typeof import("../src/translators/translator").Translator;
/** fallback name for enum key resolver */
enumKeyResolverName?: string;
/** fallback name for type name resolver */
Expand Down Expand Up @@ -279,7 +279,7 @@ type PrimitiveTypeStructValue =
| string
| ((
schema: Record<string, any>,
parser: import("./src/schema-parser/schema-parser").SchemaParser,
parser: import("../src/schema-parser/schema-parser").SchemaParser,
) => string);

type PrimitiveTypeStruct = Record<
Expand Down Expand Up @@ -366,7 +366,7 @@ export interface Hooks {
/** Start point of work this tool (after fetching schema) */
onInit?: <C extends GenerateApiConfiguration["config"]>(
configuration: C,
codeGenProcess: import("./src/code-gen-process").CodeGenProcess,
codeGenProcess: import("../src/code-gen-process").CodeGenProcess,
) => C | void;
/** customize configuration object before sending it to ETA templates */
onPrepareConfig?: <C extends GenerateApiConfiguration>(
Expand Down Expand Up @@ -657,11 +657,11 @@ export interface GenerateApiConfiguration {
/** do not use constructor args, it can break functionality of this property, just send class reference */
customTranslator?: new (
...args: never[]
) => typeof import("./src/translators/translator").Translator;
) => typeof import("../src/translators/translator").Translator;
internalTemplateOptions: {
addUtilRequiredKeysType: boolean;
};
componentTypeNameResolver: typeof import("./src/component-type-name-resolver").ComponentTypeNameResolver;
componentTypeNameResolver: typeof import("../src/component-type-name-resolver").ComponentTypeNameResolver;
fileNames: {
dataContracts: string;
routeTypes: string;
Expand Down Expand Up @@ -754,7 +754,7 @@ export interface GenerateApiOutput {
renderTemplate: (
templateContent: string,
data: Record<string, unknown>,
etaOptions?: import("eta/dist/types/config").PartialConfig,
etaOptions?: Partial<import("eta").EtaConfig>,
) => string;
getTemplate: (params: {
fileName?: string;
Expand Down

0 comments on commit 700ebae

Please sign in to comment.