UNPKG

657 BTypeScriptView Raw
1type Path = string | RegExp;
2type PathParams<KeyType extends keyof any = string> = {
3 [ParamName in KeyType]?: string | ReadonlyArray<string>;
4};
5interface Match {
6 matches: boolean;
7 params?: PathParams;
8}
9/**
10 * Coerce a path supported by MSW into a path
11 * supported by "path-to-regexp".
12 */
13declare function coercePath(path: string): string;
14/**
15 * Returns the result of matching given request URL against a mask.
16 */
17declare function matchRequestUrl(url: URL, path: Path, baseUrl?: string): Match;
18declare function isPath(value: unknown): value is Path;
19
20export { type Match, type Path, type PathParams, coercePath, isPath, matchRequestUrl };