Skip to content

Commit

Permalink
Better type for compile (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkel authored Jul 13, 2024
1 parent f73ec6c commit 7015c1f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe("path-to-regexp", () => {
const toPath = compile("{/:foo}+");

expect(() => {
toPath({ foo: [1, "a"] });
toPath({ foo: [1, "a"] as any });
}).toThrow(new TypeError('Expected "foo/0" to be a string'));
});

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export function parse(str: string, options: ParseOptions = {}): TokenData {
/**
* Compile a string to a template function for the path.
*/
export function compile<P extends object = object>(
export function compile<P extends ParamData = ParamData>(
path: Path,
options: CompileOptions = {},
) {
Expand Down

0 comments on commit 7015c1f

Please sign in to comment.