Skip to content

Commit

Permalink
Re-adding final type declarations
Browse files Browse the repository at this point in the history
I think the pre-commit hook stripped these, so i'm re-adding them so as not to create an unnecessary diff, but I don't think they're strictly necessary?
  • Loading branch information
izaaklauer committed Sep 18, 2024
1 parent deb5b9d commit 2ca5f93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/shared/src/pathToRegexp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { match as matchBase, pathToRegexp as pathToRegexpBase } from './compiled
export const pathToRegexp = (path: string) => {
try {
// @ts-ignore no types exists for the pre-compiled package
return pathToRegexpBase(path);
return pathToRegexpBase(path) as RegExp;
} catch (e: any) {
throw new Error(
`Invalid path: ${path}.\nConsult the documentation of path-to-regexp here: https://github.com/pillarjs/path-to-regexp/tree/6.x\n${e.message}`,
Expand All @@ -25,7 +25,7 @@ export function match<P extends object = object>(
): MatchFunction<P> {
try {
// @ts-ignore no types exists for the pre-compiled package
return matchBase(str, options);
return matchBase(str, options) as MatchFunction<P>;
} catch (e: any) {
throw new Error(
`Invalid path and options: Consult the documentation of path-to-regexp here: https://github.com/pillarjs/path-to-regexp/tree/6.x\n${e.message}`,
Expand Down

0 comments on commit 2ca5f93

Please sign in to comment.