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
1708497b
Unverified
Commit
1708497b
authored
Feb 21, 2025
by
Jiachi Liu
Committed by
GitHub
Feb 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: option to disable next types plugin (#76300)
parent
74c99d2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
next.ts
packages/next/src/server/next.ts
+4
-1
index.ts
packages/next/src/server/typescript/index.ts
+11
-0
No files found.
packages/next/src/server/next.ts
View file @
1708497b
...
@@ -466,7 +466,10 @@ function createServer(
...
@@ -466,7 +466,10 @@ function createServer(
'typescript'
in
options
&&
'typescript'
in
options
&&
'version'
in
(
options
as
any
).
typescript
'version'
in
(
options
as
any
).
typescript
)
{
)
{
return
require
(
'./next-typescript'
).
createTSPlugin
(
options
)
const
pluginMod
:
typeof
import
(
'./next-typescript'
)
=
require
(
'./next-typescript'
)
return
pluginMod
.
createTSPlugin
(
options
as
any
)
as
unknown
as
NextWrapperServer
}
}
if
(
options
==
null
)
{
if
(
options
==
null
)
{
...
...
packages/next/src/server/typescript/index.ts
View file @
1708497b
...
@@ -28,6 +28,10 @@ import metadata from './rules/metadata'
...
@@ -28,6 +28,10 @@ import metadata from './rules/metadata'
import
errorEntry
from
'./rules/error'
import
errorEntry
from
'./rules/error'
import
type
tsModule
from
'typescript/lib/tsserverlibrary'
import
type
tsModule
from
'typescript/lib/tsserverlibrary'
type
NextTypePluginOptions
=
{
enabled
?:
boolean
}
export
const
createTSPlugin
:
tsModule
.
server
.
PluginModuleFactory
=
({
export
const
createTSPlugin
:
tsModule
.
server
.
PluginModuleFactory
=
({
typescript
:
ts
,
typescript
:
ts
,
})
=>
{
})
=>
{
...
@@ -44,6 +48,13 @@ export const createTSPlugin: tsModule.server.PluginModuleFactory = ({
...
@@ -44,6 +48,13 @@ export const createTSPlugin: tsModule.server.PluginModuleFactory = ({
proxy
[
k
]
=
(...
args
:
Array
<
{}
>
)
=>
x
.
apply
(
info
.
languageService
,
args
)
proxy
[
k
]
=
(...
args
:
Array
<
{}
>
)
=>
x
.
apply
(
info
.
languageService
,
args
)
}
}
const
pluginOptions
:
NextTypePluginOptions
=
info
.
config
??
{
enabled
:
true
,
}
if
(
!
pluginOptions
.
enabled
)
{
return
proxy
}
// Auto completion
// Auto completion
proxy
.
getCompletionsAtPosition
=
(
proxy
.
getCompletionsAtPosition
=
(
fileName
:
string
,
fileName
:
string
,
...
...
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