Commit 7b25e299 authored by Luis Fernando Alvarez D's avatar Luis Fernando Alvarez D Committed by Joe Haddad

Export types for link props (#7905)

* export LinkProps

* Add test
parent 8078273a
...@@ -45,9 +45,9 @@ function formatUrl(url: Url) { ...@@ -45,9 +45,9 @@ function formatUrl(url: Url) {
return url && typeof url === 'object' ? formatWithValidation(url) : url return url && typeof url === 'object' ? formatWithValidation(url) : url
} }
type LinkProps = { export type LinkProps = {
href: Url href: Url
as?: Url | undefined as?: Url
replace?: boolean replace?: boolean
scroll?: boolean scroll?: boolean
shallow?: boolean shallow?: boolean
......
import React from 'react'
import Link, { LinkProps } from 'next/link'
export default () => {
const props: LinkProps = {
href: '/page',
as: '/as-page',
onError() {},
}
return (
<Link {...props}>
<a>Test</a>
</Link>
)
}
...@@ -3,6 +3,7 @@ import { useRouter } from 'next/router' ...@@ -3,6 +3,7 @@ import { useRouter } from 'next/router'
import { hello } from '../components/hello' import { hello } from '../components/hello'
import { World } from '../components/world' import { World } from '../components/world'
import Router from '../components/router' import Router from '../components/router'
import Link from '../components/link'
export default function HelloPage(): JSX.Element { export default function HelloPage(): JSX.Element {
const router = useRouter() const router = useRouter()
...@@ -12,6 +13,7 @@ export default function HelloPage(): JSX.Element { ...@@ -12,6 +13,7 @@ export default function HelloPage(): JSX.Element {
<div> <div>
{hello()} <World /> {hello()} <World />
<Router /> <Router />
<Link />
</div> </div>
) )
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment