Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Jul 5, 2023
1 parent c4c5466 commit f5aae39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/routes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ declare type RequiredParameters<T extends number> = T extends 1 ? [RequiredRoute
RequiredRouteParameter,
RequiredRouteParameter
] : RequiredRouteParameter[];
declare type RouteHelperOptions<T extends string> = RouteOptions & Optional<Record<T, OptionalRouteParameter>>;
declare type RouteHelper<T extends number = number, U extends string = string> = ((...args: [...RequiredParameters<T>, RouteHelperOptions<U>]) => string) & RouteHelperExtras;
declare type RouteHelperOptions = RouteOptions & Record<string, OptionalRouteParameter>;
declare type RouteHelper<T extends number = number> = ((...args: [...RequiredParameters<T>, RouteHelperOptions]) => string) & RouteHelperExtras;
declare type RouteHelpers = Record<string, RouteHelper>;
declare type Configuration = {
prefix: string;
Expand Down
9 changes: 4 additions & 5 deletions lib/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ type RequiredParameters<T extends number> = T extends 1
]
: RequiredRouteParameter[];

type RouteHelperOptions<T extends string> = RouteOptions &
Optional<Record<T, OptionalRouteParameter>>;
type RouteHelperOptions = RouteOptions & Record<string, OptionalRouteParameter>;

type RouteHelper<T extends number = number, U extends string = string> = ((
...args: [...RequiredParameters<T>, RouteHelperOptions<U>]
type RouteHelper<T extends number = number> = ((
...args: [...RequiredParameters<T>, RouteHelperOptions]
) => string) &
RouteHelperExtras;

Expand Down Expand Up @@ -539,7 +538,7 @@ RubyVariables.WRAPPER(
let key: string;
switch (route[0]) {
case NodeTypes.GROUP:
return "(" + this.build_path_spec(route[1]) + ")";
return `(${this.build_path_spec(route[1])})`;
case NodeTypes.CAT:
return (
this.build_path_spec(route[1]) + this.build_path_spec(route[2])
Expand Down
4 changes: 2 additions & 2 deletions spec/js_routes/module_types/dts/routes.spec.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ declare type RequiredParameters<T extends number> = T extends 1 ? [RequiredRoute
RequiredRouteParameter,
RequiredRouteParameter
] : RequiredRouteParameter[];
declare type RouteHelperOptions<T extends string> = RouteOptions & Optional<Record<T, OptionalRouteParameter>>;
declare type RouteHelper<T extends number = number, U extends string = string> = ((...args: [...RequiredParameters<T>, RouteHelperOptions<U>]) => string) & RouteHelperExtras;
declare type RouteHelperOptions = RouteOptions & Record<string, OptionalRouteParameter>;
declare type RouteHelper<T extends number = number> = ((...args: [...RequiredParameters<T>, RouteHelperOptions]) => string) & RouteHelperExtras;
declare type RouteHelpers = Record<string, RouteHelper>;
declare type Configuration = {
prefix: string;
Expand Down

0 comments on commit f5aae39

Please sign in to comment.