diff --git a/build.mjs b/build.mjs index 275bb06..8321d4e 100644 --- a/build.mjs +++ b/build.mjs @@ -1,4 +1,4 @@ -import dts from 'bun-plugin-dts' +import dts from 'bun-plugin-dts'; await Bun.build({ entrypoints: ['./src/index.ts'], @@ -10,4 +10,4 @@ await Bun.build({ plugins: [ dts(), ], -}) +}); diff --git a/bun.lockb b/bun.lockb index 4b49d0c..2ddf860 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 88d15f9..bd1369a 100644 --- a/package.json +++ b/package.json @@ -33,14 +33,14 @@ "license": "MIT", "devDependencies": { "i18next": "^23.5.1", - "bun-plugin-dts": "^0.1.0", - "bun-types": "latest", - "elysia": "^1.0.5", + "bun-plugin-dts": "^0.3.0", + "bun-types": "^1.1.30", + "elysia": "^1.1.22", "prettier": "^3.0.3", "typescript": "^5.2.2" }, "peerDependencies": { - "elysia": ">= 0.7.1", + "elysia": ">= 1.0.1", "i18next": ">= 23.5.1" } } diff --git a/src/index.ts b/src/index.ts index bbe4641..5c3f294 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,7 +35,7 @@ export function newLanguageDetector(opts: LanguageDetectorOptions): LanguageDete const cookie = set.cookie ? set.cookie[opts.cookieName] : null if (cookie && cookie.value) { - return cookie.value + return cookie.value as string } if (params && opts.pathParamName in params) { @@ -82,7 +82,7 @@ export const i18next = (userOptions: Partial) => { }) .onBeforeHandle({ as: "global" }, async ctx => { const lng = await options.detectLanguage(ctx) - if (lng) { + if (typeof lng === 'string') { await _instance.changeLanguage(lng) } })