Skip to content

Commit

Permalink
fix platform dual predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Apr 16, 2024
1 parent 3fe683c commit 0258752
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/platform/src/internal/http/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const RouteContextTypeId: Router.RouteContextTypeId = Symbol.for(
/** @internal */
export const RouteContext = Context.GenericTag<Router.RouteContext>("@effect/platform/Http/Router/RouteContext")

const isRouter = (u: unknown): u is Router.Router<unknown, unknown> => Predicate.hasProperty(u, TypeId)

/** @internal */
export const params = Effect.map(RouteContext, (_) => _.params)

Expand Down Expand Up @@ -437,7 +439,7 @@ export const route = (method: Method.Method | "*"): {
readonly uninterruptible?: boolean | undefined
} | undefined
) => Router.Router<E | E1, R | Router.Router.ExcludeProvided<R1>>
>(3, (self, path, handler, options) =>
>((args) => isRouter(args[0]), (self, path, handler, options) =>
new RouterImpl<any, any>(
Chunk.append(
self.routes,
Expand Down

0 comments on commit 0258752

Please sign in to comment.