File tree 1 file changed +8
-8
lines changed
packages/next/src/server/typescript
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,6 @@ 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
-
35
31
export const createTSPlugin : tsModule . server . PluginModuleFactory = ( {
36
32
typescript : ts ,
37
33
} ) => {
@@ -48,10 +44,14 @@ export const createTSPlugin: tsModule.server.PluginModuleFactory = ({
48
44
proxy [ k ] = ( ...args : Array < { } > ) => x . apply ( info . languageService , args )
49
45
}
50
46
51
- const pluginOptions : NextTypePluginOptions = info . config ?? {
52
- enabled : true ,
53
- }
54
- if ( ! pluginOptions . enabled ) {
47
+ // Get plugin options
48
+ // config is the plugin options from the user's tsconfig.json
49
+ // e.g. { "plugins": [{ "name": "next", "enabled": true }] }
50
+ // config will be { "name": "next", "enabled": true }
51
+ // The default user config is { "name": "next" }
52
+ const isPluginEnabled = info . config . enabled ?? true
53
+
54
+ if ( ! isPluginEnabled ) {
55
55
return proxy
56
56
}
57
57
You can’t perform that action at this time.
0 commit comments