Skip to content

Commit 9da13d8

Browse files
committed
refactor: simplify
1 parent ea77ad9 commit 9da13d8

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

packages/router/src/RouterLink.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,25 +361,33 @@ export const RouterLinkImpl = /*#__PURE__*/ defineComponent({
361361
export const RouterLink: _RouterLinkI = RouterLinkImpl as any
362362

363363
/**
364-
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
365-
* automatically for JSX.
366-
*
367364
* @internal
368365
*/
369-
type LinkAnchorAttrs = Omit<AnchorHTMLAttributes, 'href'>
370-
371366
type _BaseRouterLinkProps = AllowedComponentProps &
372367
ComponentCustomProps &
373368
VNodeProps &
374369
RouterLinkProps
375370

376-
type RouterLinkTypedProps<C extends boolean | undefined> = C extends true
377-
? _BaseRouterLinkProps & { custom: true }
378-
: _BaseRouterLinkProps & { custom?: false | undefined } & LinkAnchorAttrs
371+
/**
372+
* @internal
373+
*/
374+
type RouterLinkTypedProps<Custom extends boolean | undefined> =
375+
Custom extends true
376+
? _BaseRouterLinkProps & { custom: true }
377+
: _BaseRouterLinkProps & { custom?: false | undefined } & Omit<
378+
AnchorHTMLAttributes,
379+
'href'
380+
>
379381

382+
/**
383+
* Typed version of the `RouterLink` component. Its generic defaults to the typed router, so it can be inferred
384+
* automatically for JSX.
385+
*
386+
* @internal
387+
*/
380388
export interface _RouterLinkI {
381-
new <C extends boolean | undefined = boolean | undefined>(): {
382-
$props: RouterLinkTypedProps<C>
389+
new <Custom extends boolean | undefined = boolean | undefined>(): {
390+
$props: RouterLinkTypedProps<Custom>
383391

384392
$slots: {
385393
default?: ({

0 commit comments

Comments
 (0)