Skip to content

Commit

Permalink
fix: make resolver commands argument optional
Browse files Browse the repository at this point in the history
  • Loading branch information
platosha committed Oct 7, 2024
1 parent cfe7064 commit d758d3b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/resolver/resolveRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import type { ActionResult, AnyObject, MaybePromise, RouteContext } from './types.js';
import { isFunction } from './utils.js';

// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
export default function resolveRoute<T, R extends AnyObject, C extends AnyObject>(
context: RouteContext<T, R, C>,
): MaybePromise<ActionResult<T | RouteContext<T, R, C>>> {
if (isFunction(context.route.action)) {
// @ts-expect-error: ignore "never" type here
return context.route.action(context);
}
return undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/resolver/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type BasicRoutePart<T, R extends AnyObject, C extends AnyObject> = Readon
action?(
this: Route<T, R, C>,
context: RouteContext<T, R, C>,
commands: never,
commands?: never,
): MaybePromise<ActionResult<T | RouteContext<T, R, C>>>;
}> & {
__children?: ReadonlyArray<Route<T, R, C>>;
Expand Down

0 comments on commit d758d3b

Please sign in to comment.