8000 Better type for compile (#307) · pillarjs/path-to-regexp@7015c1f · GitHub
[go: up one dir, main page]

Skip to content

Commit 7015c1f

Browse files
authored
Better type for compile (#307)
1 parent f73ec6c commit 7015c1f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe("path-to-regexp", () => {
161161
const toPath = compile("{/:foo}+");
162162

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

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ export function parse(str: string, options: ParseOptions = {}): TokenData {
328328
/**
329329
* Compile a string to a template function for the path.
330330
*/
331-
export function compile<P extends object = object>(
331+
export function compile<P extends ParamData = ParamData>(
332332
path: Path,
333333
options: CompileOptions = {},
334334
) {

0 commit comments

Comments
 (0)
0