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
f2a295de
Unverified
Commit
f2a295de
authored
Jan 25, 2023
by
Shu Ding
Committed by
GitHub
Jan 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typo in TS plugin (#45279)
parent
e8b208d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
next-typescript.ts
packages/next/src/server/next-typescript.ts
+15
-16
No files found.
packages/next/src/server/next-typescript.ts
View file @
f2a295de
...
@@ -305,15 +305,15 @@ export function createTSPlugin(modules: {
...
@@ -305,15 +305,15 @@ export function createTSPlugin(modules: {
)
)
)
{
)
{
if
(
ts
.
isVariableDeclarationList
(
node
.
declarationList
))
{
if
(
ts
.
isVariableDeclarationList
(
node
.
declarationList
))
{
for
(
const
declara
r
tion
of
node
.
declarationList
.
declarations
)
{
for
(
const
declaration
of
node
.
declarationList
.
declarations
)
{
if
(
if
(
declara
r
tion
.
getFullStart
()
<=
position
&&
declaration
.
getFullStart
()
<=
position
&&
position
<=
position
<=
declara
rtion
.
getFullStart
()
+
declarar
tion
.
getFullWidth
()
declara
tion
.
getFullStart
()
+
declara
tion
.
getFullWidth
()
)
{
)
{
// `export const ... = ...`
// `export const ... = ...`
const
text
=
declara
r
tion
.
name
.
getText
()
const
text
=
declaration
.
name
.
getText
()
callback
(
text
,
declara
r
tion
)
callback
(
text
,
declaration
)
}
}
}
}
}
}
...
@@ -369,13 +369,12 @@ export function createTSPlugin(modules: {
...
@@ -369,13 +369,12 @@ export function createTSPlugin(modules: {
}
}
// Auto completion for entry exported configs.
// Auto completion for entry exported configs.
visitEntryConfig
(
fileName
,
position
,
(
entryConfig
,
declara
r
tion
)
=>
{
visitEntryConfig
(
fileName
,
position
,
(
entryConfig
,
declaration
)
=>
{
if
(
!
API_DOCS
[
entryConfig
])
{
if
(
!
API_DOCS
[
entryConfig
])
{
if
(
if
(
declara
r
tion
.
name
.
getFullStart
()
<=
position
&&
declaration
.
name
.
getFullStart
()
<=
position
&&
position
<=
position
<=
declarartion
.
name
.
getFullStart
()
+
declaration
.
name
.
getFullStart
()
+
declaration
.
name
.
getFullWidth
()
declarartion
.
name
.
getFullWidth
()
)
{
)
{
prior
.
entries
=
[
prior
.
entries
=
[
...
prior
.
entries
,
...
prior
.
entries
,
...
@@ -569,11 +568,11 @@ export function createTSPlugin(modules: {
...
@@ -569,11 +568,11 @@ export function createTSPlugin(modules: {
}
}
let
overriden
:
ts
.
QuickInfo
|
undefined
let
overriden
:
ts
.
QuickInfo
|
undefined
visitEntryConfig
(
fileName
,
position
,
(
entryConfig
,
declara
r
tion
)
=>
{
visitEntryConfig
(
fileName
,
position
,
(
entryConfig
,
declaration
)
=>
{
if
(
!
API_DOCS
[
entryConfig
])
return
if
(
!
API_DOCS
[
entryConfig
])
return
const
name
=
declara
r
tion
.
name
const
name
=
declaration
.
name
const
value
=
declara
r
tion
.
initializer
const
value
=
declaration
.
initializer
const
docsLink
=
{
const
docsLink
=
{
kind
:
'text'
,
kind
:
'text'
,
...
@@ -712,8 +711,8 @@ export function createTSPlugin(modules: {
...
@@ -712,8 +711,8 @@ export function createTSPlugin(modules: {
)
{
)
{
// Check if it has correct option exports
// Check if it has correct option exports
if
(
ts
.
isVariableDeclarationList
(
node
.
declarationList
))
{
if
(
ts
.
isVariableDeclarationList
(
node
.
declarationList
))
{
for
(
const
declara
r
tion
of
node
.
declarationList
.
declarations
)
{
for
(
const
declaration
of
node
.
declarationList
.
declarations
)
{
const
name
=
declara
r
tion
.
name
const
name
=
declaration
.
name
if
(
ts
.
isIdentifier
(
name
))
{
if
(
ts
.
isIdentifier
(
name
))
{
if
(
if
(
!
ALLOWED_EXPORTS
.
includes
(
name
.
text
)
&&
!
ALLOWED_EXPORTS
.
includes
(
name
.
text
)
&&
...
@@ -729,7 +728,7 @@ export function createTSPlugin(modules: {
...
@@ -729,7 +728,7 @@ export function createTSPlugin(modules: {
})
})
}
else
if
(
API_DOCS
[
name
.
text
])
{
}
else
if
(
API_DOCS
[
name
.
text
])
{
// Check if the value is valid
// Check if the value is valid
const
value
=
declara
r
tion
.
initializer
const
value
=
declaration
.
initializer
if
(
value
)
{
if
(
value
)
{
let
displayedValue
=
''
let
displayedValue
=
''
...
@@ -808,7 +807,7 @@ export function createTSPlugin(modules: {
...
@@ -808,7 +807,7 @@ export function createTSPlugin(modules: {
}
else
if
(
name
.
text
===
LEGACY_CONFIG_EXPORT
)
{
}
else
if
(
name
.
text
===
LEGACY_CONFIG_EXPORT
)
{
// export const config = { ... }
// export const config = { ... }
// Error if using `amp: ...`
// Error if using `amp: ...`
const
value
=
declara
r
tion
.
initializer
const
value
=
declaration
.
initializer
if
(
value
&&
ts
.
isObjectLiteralExpression
(
value
))
{
if
(
value
&&
ts
.
isObjectLiteralExpression
(
value
))
{
for
(
const
prop
of
value
.
properties
)
{
for
(
const
prop
of
value
.
properties
)
{
if
(
if
(
...
...
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