try-to-parse-path.d.ts 696 B

12345678910111213141516171819
  1. import type { Token } from 'next/dist/compiled/path-to-regexp';
  2. interface ParseResult {
  3. error?: any;
  4. parsedPath: string;
  5. regexStr?: string;
  6. route: string;
  7. tokens?: Token[];
  8. }
  9. /**
  10. * Attempts to parse a given route with `path-to-regexp` and returns an object
  11. * with the result. Whenever an error happens on parse, it will print an error
  12. * attempting to find the error position and showing a link to the docs. When
  13. * `handleUrl` is set to `true` it will also attempt to parse the route
  14. * and use the resulting pathname to parse with `path-to-regexp`.
  15. */
  16. export declare function tryToParsePath(route: string, options?: {
  17. handleUrl?: boolean;
  18. }): ParseResult;
  19. export {};