Skip to content

Commit 55d7341

Browse files
committed
refactor(types): avoid eager evaluation of routerlink
1 parent c297f39 commit 55d7341

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/router/src/RouterLink.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
261261
/**
262262
* Component to render a link that triggers a navigation on click.
263263
*/
264-
export const RouterLink = RouterLinkImpl as unknown as RouterLinkTyped
264+
export const RouterLink: RouterLinkTyped = RouterLinkImpl as any
265265

266266
/**
267267
* Typed version of the `RouterLink` component. Its generic defaults to the typed router so it can be inferred

packages/router/test-dts/components.test-d.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ expectType<JSX.Element>(<RouterLink class="link" to="/foo" />)
2525
expectType<JSX.Element>(<RouterLink to={{ path: '/foo' }} />)
2626
expectType<JSX.Element>(<RouterLink to={{ path: '/foo' }} custom />)
2727
// @ts-expect-error: non existing name
28-
expectType<JSX.Element>(<RouterLink to={{ name: 'nope' }} custom />)
28+
expectError(<RouterLink to={{ name: '' }} />)
2929

3030
// RouterView
3131
expectType<JSX.Element>(<RouterView class="view" />)

0 commit comments

Comments
 (0)