Skip to content

Commit

Permalink
refactor(timing): don't use Partial for the options (#2712)
Browse files Browse the repository at this point in the history
* refactor(timing): dont' use `Partial` for the options

* denoify
  • Loading branch information
yusukebe authored May 18, 2024
1 parent d87d996 commit b7d72fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions deno_dist/middleware/timing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ interface Timer {
}

interface TimingOptions {
total: boolean
enabled: boolean | ((c: Context) => boolean)
totalDescription: string
autoEnd: boolean
crossOrigin: boolean | string | ((c: Context) => boolean | string)
total?: boolean
enabled?: boolean | ((c: Context) => boolean)
totalDescription?: string
autoEnd?: boolean
crossOrigin?: boolean | string | ((c: Context) => boolean | string)
}

const getTime = (): number => {
Expand All @@ -31,7 +31,7 @@ const getTime = (): number => {
return Date.now()
}

export const timing = (config?: Partial<TimingOptions>): MiddlewareHandler => {
export const timing = (config?: TimingOptions): MiddlewareHandler => {
const options: TimingOptions = {
...{
total: true,
Expand Down
12 changes: 6 additions & 6 deletions src/middleware/timing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ interface Timer {
}

interface TimingOptions {
total: boolean
enabled: boolean | ((c: Context) => boolean)
totalDescription: string
autoEnd: boolean
crossOrigin: boolean | string | ((c: Context) => boolean | string)
total?: boolean
enabled?: boolean | ((c: Context) => boolean)
totalDescription?: string
autoEnd?: boolean
crossOrigin?: boolean | string | ((c: Context) => boolean | string)
}

const getTime = (): number => {
Expand All @@ -31,7 +31,7 @@ const getTime = (): number => {
return Date.now()
}

export const timing = (config?: Partial<TimingOptions>): MiddlewareHandler => {
export const timing = (config?: TimingOptions): MiddlewareHandler => {
const options: TimingOptions = {
...{
total: true,
Expand Down

0 comments on commit b7d72fd

Please sign in to comment.