Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import * as preact from 'preact';
export function route(url: string, replace?: boolean): boolean;
export function route(options: { url: string; replace?: boolean }): boolean;

export function exec(url: string, route: string, opts: { default?: boolean }): false | Record<string, string | undefined>;
export function exec(
url: string,
route: string,
opts: { default?: boolean }
): false | Record<string, string | undefined>;

export function getCurrentUrl(): string;

Expand Down Expand Up @@ -69,9 +73,7 @@ export function Route<Props>(
props: RouteProps<Props> & Partial<Props>
): preact.VNode;

export function Link(
props: preact.JSX.HTMLAttributes<HTMLAnchorElement>
): preact.VNode;
export function Link(props: preact.JSX.IntrinsicElements['a']): preact.VNode;

export function useRouter<
RouteParams extends Record<string, string | undefined> | null = Record<
Expand Down
6 changes: 5 additions & 1 deletion match/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ export class Match extends preact.Component<RoutableProps, {}> {
render(): preact.VNode;
}

export interface LinkProps extends preact.JSX.HTMLAttributes<HTMLAnchorElement> {
// Typescript doesn't allow to extends directly from an expression (see
// https://github.com/microsoft/TypeScript/issues/31843). Assigning to a
// separate type first makes it work.
type AnchorElement = preact.JSX.IntrinsicElements['a'];
export interface LinkProps extends AnchorElement {
activeClassName?: string;
children?: preact.ComponentChildren;
}
Expand Down
Loading