Skip to content

Commit 6279e6c

Browse files
committed
chore: introduce @bob-translate/types package to improve type definitions
1 parent 1015fb3 commit 6279e6c

23 files changed

+28
-492
lines changed

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
"build": "rollup --config rollup.config.ts --configPlugin typescript"
1616
},
1717
"devDependencies": {
18-
"typescript": "5.5.4",
18+
"@bob-translate/types": "1.0.1",
1919
"@rollup/plugin-terser": "0.4.4",
2020
"@rollup/plugin-typescript": "11.1.6",
2121
"rollup": "4.20.0",
2222
"rollup-plugin-copy": "3.5.0",
23-
"tslib": "2.6.3"
23+
"tslib": "2.6.3",
24+
"typescript": "5.5.4"
2425
},
2526
"engines": {
2627
"node": ">=20"

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/const.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,4 @@ export const HTTP_ERROR_CODES = {
4242
511: "Network Authentication Required"
4343
} as const;
4444

45-
export type HttpErrorCode = keyof typeof HTTP_ERROR_CODES;
46-
4745
export const SYSTEM_PROMPT = "You are a translation engine that can only translate text and cannot interpret it." as const;

src/global.d.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/lang.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,4 @@ export const supportLanguageList = [
116116
["zu", "zu"],
117117
] as const;
118118

119-
export type Language = typeof supportLanguageList[number][0];
120-
121119
export const langMap = new Map(supportLanguageList.map(([key, value]) => [key, value]));

src/main.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { SYSTEM_PROMPT } from "./const";
22
import { langMap, supportLanguageList } from "./lang";
3-
import { ChatCompletion, ModelList } from "./types";
4-
import { HttpResponse } from "./types/http.type";
5-
import type { PluginValidate } from "./types/plugin-validate.type";
6-
import type { ServiceError } from "./types/service-error.type";
7-
import type { TextTranslate, TextTranslateQuery } from "./types/text-translate.type";
3+
import type { ChatCompletion, ModelList } from "./types";
4+
import type {
5+
HttpResponse,
6+
PluginValidate,
7+
ServiceError,
8+
TextTranslate,
9+
TextTranslateQuery
10+
} from "@bob-translate/types";
811
import {
912
buildHeader,
1013
ensureHttpsAndNoTrailingSlash,

src/types/data.type.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/types/env.type.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/types/file.type.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/types/http.type.ts

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)