File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -466,7 +466,10 @@ function createServer(
466
466
'typescript' in options &&
467
467
'version' in ( options as any ) . typescript
468
468
) {
469
- return require ( './next-typescript' ) . createTSPlugin ( options )
469
+ const pluginMod : typeof import ( './next-typescript' ) = require ( './next-typescript' )
470
+ return pluginMod . createTSPlugin (
471
+ options as any
472
+ ) as unknown as NextWrapperServer
470
473
}
471
474
472
475
if ( options == null ) {
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ import metadata from './rules/metadata'
28
28
import errorEntry from './rules/error'
29
29
import type tsModule from 'typescript/lib/tsserverlibrary'
30
30
31
+ type NextTypePluginOptions = {
32
+ enabled ?: boolean
33
+ }
34
+
31
35
export const createTSPlugin : tsModule . server . PluginModuleFactory = ( {
32
36
typescript : ts ,
33
37
} ) => {
@@ -44,6 +48,13 @@ export const createTSPlugin: tsModule.server.PluginModuleFactory = ({
44
48
proxy [ k ] = ( ...args : Array < { } > ) => x . apply ( info . languageService , args )
45
49
}
46
50
51
+ const pluginOptions : NextTypePluginOptions = info . config ?? {
52
+ enabled : true ,
53
+ }
54
+ if ( ! pluginOptions . enabled ) {
55
+ return proxy
56
+ }
57
+
47
58
// Auto completion
48
59
proxy . getCompletionsAtPosition = (
49
60
fileName : string ,
You can’t perform that action at this time.
0 commit comments