Skip to content

Commit

Permalink
fix(useTitle): correct unify type name
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Jul 3, 2024
1 parent 2ced915 commit 19338b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/use-title/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { Gettable } from '../utils/basic'
/**
* `%s` will be replaced by the title if the template is a `string`
*/
export type UseTitleTemplate = string | ((title: string) => string)
export type UseTitleOptionsTemplate = string | ((title: string) => string)

export type UseTitleOptions = {
/**
Expand All @@ -26,7 +26,7 @@ export type UseTitleOptions = {
*
* @defaultValue '%s'
*/
template?: UseTitleTemplate
template?: UseTitleOptionsTemplate
}

/**
Expand Down Expand Up @@ -60,6 +60,6 @@ export function useTitle(newTitle: Gettable<string>, options: UseTitleOptions =
return restore
}

function format(text: string, template: UseTitleTemplate) {
function format(text: string, template: UseTitleOptionsTemplate) {
return isFunction(template) ? template(text) : template.replace(/%s/g, text)
}

0 comments on commit 19338b9

Please sign in to comment.