Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7b25e299
Commit
7b25e299
authored
Jul 11, 2019
by
Luis Fernando Alvarez D
Committed by
Joe Haddad
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export types for link props (#7905)
* export LinkProps * Add test
parent
8078273a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
link.tsx
packages/next/client/link.tsx
+2
-2
link.tsx
test/integration/typescript/components/link.tsx
+16
-0
hello.tsx
test/integration/typescript/pages/hello.tsx
+2
-0
No files found.
packages/next/client/link.tsx
View file @
7b25e299
...
@@ -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
...
...
test/integration/typescript/components/link.tsx
0 → 100644
View file @
7b25e299
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
>
)
}
test/integration/typescript/pages/hello.tsx
View file @
7b25e299
...
@@ -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
>
)
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment