Skip to content

Commit

Permalink
fix: remove no nullable type from I18nMiddleware (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Nov 15, 2023
1 parent a863982 commit 8f59b79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
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
Expand Up @@ -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"
},
Expand All @@ -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",
Expand Down
9 changes: 3 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']>
}

/**
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 8f59b79

Please sign in to comment.