Skip to content
Merged
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
7 changes: 7 additions & 0 deletions src/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ export type RoutePropsForPath<Path extends string> = Path extends '*'
export function Route<Props>(props: RouteProps<Props> & Partial<Props>): VNode;

declare module 'preact' {
// The code below automatically adds `path` and `default` as optional props for every component
// (effectively reserving those names, so no component should use those names in its own props).
// These declarations extend from `RouteableProps`, which is not allowed in modern TypeScript and
// causes a TS2312 error. However, the compiler does seems to honor the intent of this code, so
// to avoid an API regression, let's ignore the error rather than loosening the type validation.
namespace JSX {
/** @ts-ignore */
interface IntrinsicAttributes extends RoutableProps {}
}
/** @ts-ignore */
interface Attributes extends RoutableProps {}
}