diff --git a/packages/path/src/Interpolate.ts b/packages/path/src/Interpolate.ts
index ef738a442..adcf8a2c8 100644
--- a/packages/path/src/Interpolate.ts
+++ b/packages/path/src/Interpolate.ts
@@ -4,7 +4,7 @@
* @since 1.0.0
*/
-import type { S } from "ts-toolbelt"
+import type { A, S } from "ts-toolbelt"
import type {
ModifierNode,
NamedParamNode,
@@ -25,12 +25,13 @@ import type { PathJoin } from "./PathJoin.js"
* Interpolate a path with parameters
* @since 1.0.0
*/
-export type Interpolate
> = PathJoin<
- InterpolateParts<
- ParseSegments>,
- Params
+export type Interpolate> = A.Equals
extends 1 ? string :
+ PathJoin<
+ InterpolateParts<
+ ParseSegments>,
+ Params
+ >
>
->
type InterpolateParts<
T extends ReadonlyArray,
diff --git a/packages/path/src/ParamsOf.ts b/packages/path/src/ParamsOf.ts
index 8a990e9a1..5c37a371a 100644
--- a/packages/path/src/ParamsOf.ts
+++ b/packages/path/src/ParamsOf.ts
@@ -4,6 +4,7 @@
* @since 1.0.0
*/
+import type { A } from "ts-toolbelt"
import type {
Modifier,
ModifierNode,
@@ -24,7 +25,7 @@ import type {
* Extract the parameters from a path
* @since 1.0.0
*/
-export type ParamsOf = ToParams>>
+export type ParamsOf = A.Equals extends 1 ? {} : ToParams>>
type ToParams, Params = {}> = [
// @ts-expect-error Type potentially infinite
diff --git a/packages/router/src/CurrentRoute.ts b/packages/router/src/CurrentRoute.ts
index ce2bf7d78..0ae440fd6 100644
--- a/packages/router/src/CurrentRoute.ts
+++ b/packages/router/src/CurrentRoute.ts
@@ -49,7 +49,7 @@ export function layer(
route: P | Route.Route,
parent: Option.Option = Option.none()
): Layer.Layer {
- return CurrentRoute.layer(make(route as Route.Route, parent))
+ return CurrentRoute.layer(make(route, parent) as any as CurrentRoute)
}
function getRoute(route: P | Route.Route
): Route.Route
{
@@ -59,9 +59,12 @@ function getRoute
(route: P | Route.Route
): Route.Route
{
/**
* @since 1.0.0
*/
-export const CurrentParams: RefSubject.Filtered>, never, Navigation | CurrentRoute> =
- RefSubject
- .filterMapEffect(CurrentPath, (path) => CurrentRoute.with(({ route }) => route.match(path)))
+export const CurrentParams: RefSubject.Filtered<
+ Readonly>>,
+ never,
+ Navigation | CurrentRoute
+> = RefSubject
+ .filterMapEffect(CurrentPath, (path) => CurrentRoute.with(({ route }) => route.match(path)))
/**
* @since 1.0.0
@@ -82,7 +85,7 @@ export const withCurrentRoute: {
Effect.contextWithEffect((ctx) => {
const parent = Context.getOption(ctx, CurrentRoute)
- if (Option.isNone(parent)) return pipe(effect, CurrentRoute.provide(make(route) as CurrentRoute))
+ if (Option.isNone(parent)) return pipe(effect, CurrentRoute.provide(make(route) as any as CurrentRoute))
return pipe(
effect,
diff --git a/packages/router/src/Matcher.ts b/packages/router/src/Matcher.ts
index 3a87f5dff..3eaf63c02 100644
--- a/packages/router/src/Matcher.ts
+++ b/packages/router/src/Matcher.ts
@@ -186,9 +186,9 @@ function getGuard(
guard?: Guard.Guard, B, E2, R2>
) {
if (guard) {
- return Guard.compose(getRoute(path), guard)
+ return Guard.compose(path, guard)
} else {
- return getRoute(path).asGuard()
+ return path.asGuard()
}
}