Skip to content

Commit 54e3624

Browse files
authored
fix: Eliminate TS2312 error for projects that don't skipLibCheck=true to ignore .d.ts errors (#130)
1 parent 09a55de commit 54e3624

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/router.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,15 @@ export type RoutePropsForPath<Path extends string> = Path extends '*'
8888
export function Route<Props>(props: RouteProps<Props> & Partial<Props>): VNode;
8989

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

0 commit comments

Comments
 (0)