Skip to content

Commit

Permalink
add resolvePath to types/index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Harris committed May 17, 2023
1 parent ab7078b commit 110d716
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1310,3 +1310,18 @@ export interface Snapshot<T = any> {
capture: () => T;
restore: (snapshot: T) => void;
}

/**
* Populate a route ID with params to resolve a pathname.
* @example
* ```js
* resolvePath(
* `/blog/[slug]/[...somethingElse]`,
* {
* slug: 'hello-world',
* somethingElse: 'something/else'
* }
* ); // `/blog/hello-world/something/else`
* ```
*/
export function resolvePath(id: string, params: Record<string, string | undefined>): string;

0 comments on commit 110d716

Please sign in to comment.