From 7015c1fd7760df38458268d36c441b0782bdf2b4 Mon Sep 17 00:00:00 2001 From: Josh Kelley Date: Sat, 13 Jul 2024 19:31:49 -0400 Subject: [PATCH] Better type for compile (#307) --- src/index.spec.ts | 2 +- src/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.spec.ts b/src/index.spec.ts index ffd092f..d0dd420 100644 --- a/src/index.spec.ts +++ b/src/index.spec.ts @@ -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')); }); diff --git a/src/index.ts b/src/index.ts index e0165ea..3f0721a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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

( +export function compile

( path: Path, options: CompileOptions = {}, ) {