Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: remove no nullable type from I18nMiddleware #15

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
"build": "unbuild",
"play:basic": "bun run ./playground/basic/index.ts",
"test": "npm run test:type && npm run test:unit",
"test:type": "vitest typecheck --run",
"test:type": "vitest run --typecheck",
"test:unit": "vitest run",
"test:coverage": "npm test -- --reporter verbose --coverage"
},
@@ -71,15 +71,15 @@
"devDependencies": {
"@types/node": "^20.6.0",
"@types/supertest": "^2.0.12",
"@vitest/coverage-v8": "^1.0.0-beta.2",
"@vitest/coverage-v8": "^1.0.0-beta.4",
"bumpp": "^9.2.0",
"gh-changelogen": "^0.2.8",
"h3": "^1.8.2",
"lint-staged": "^15.0.2",
"supertest": "^6.3.3",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vitest": "^1.0.0-beta.2"
"vitest": "^1.0.0-beta.4a"
},
"dependencies": {
"@intlify/core": "^9.6.0",
9 changes: 3 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -46,11 +46,11 @@ export interface I18nMiddleware {
/**
* `onRequest` option of `createApp`
*/
onRequest: AppOptions['onRequest']
onRequest: NonNullable<AppOptions['onRequest']>
/**
* `onAfterResponse` option of `createApp`
*/
onAfterResponse: AppOptions['onAfterResponse']
onAfterResponse: NonNullable<AppOptions['onAfterResponse']>
}

/**
@@ -101,10 +101,7 @@ export function defineI18nMiddleware<
>,
>(
options: Options,
): {
onRequest: AppOptions['onRequest']
onAfterResponse: AppOptions['onAfterResponse']
} {
): I18nMiddleware {
const i18n = createCoreContext(options as CoreOptions)
const orgLocale = i18n.locale