Skip to content

Commit

Permalink
Removing unnecessary typecasts
Browse files Browse the repository at this point in the history
  • Loading branch information
izaaklauer committed Sep 18, 2024
1 parent 2ca5f93 commit 061c555
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) as RegExp;
return pathToRegexpBase(path);
} 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) as MatchFunction<P>;
return matchBase(str, options);
} 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 061c555

Please sign in to comment.