Skip to content

Commit 9bc75da

Browse files
authored
Merge 528a5cb into df0c632
2 parents df0c632 + 528a5cb commit 9bc75da

File tree

1 file changed

+116
-1
lines changed

1 file changed

+116
-1
lines changed

docs/content/en/guide/setup.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,127 @@ You can check the [**CookBook**](/cookbook/components) section to get some TypeS
132132
> Enables TypeScript type checking on a separate process.
133133
134134
- Type: `Boolean` or `Object`
135-
- Default: `true`
135+
- Default:
136+
```ts
137+
{
138+
typescript: {
139+
configFile: '~~/tsconfig.json',
140+
extensions: {
141+
vue: true
142+
}
143+
},
144+
logger: {
145+
issues: loggerInterface
146+
}
147+
}
148+
```
136149

137150
When enabled, Nuxt.js uses [fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin) to provide type checking.
138151

152+
<alert type="warning">
153+
154+
Note that `script setup` is not supported by this webpack plugin so you won't get any type errors when using it. In that case it might be better to disable the `typecheck` option and rely on external type checking through [`vue-tsc`](https://www.npmjs.com/package/vue-tsc), for example.
155+
156+
</alert>
157+
139158
You can use an `Object` to override plugin options or set it to `false` to disable it.
140159

160+
When passing a custom object, the passed values are merged with default values.
161+
162+
These are all the options supported by `fork-ts-checker-webpack-plugin`:
163+
164+
```ts
165+
interface ForkTsCheckerWebpackPluginOptions {
166+
async: boolean
167+
typescript: TypeScriptReporterOptions
168+
eslint: EsLintReporterOptions
169+
formatter: FormatterOptions
170+
issue: IssueOptions,
171+
logger: LoggerOptions
172+
}
173+
174+
type TypeScriptReporterOptions =
175+
| boolean
176+
| {
177+
// Enable TypeScript reporter.
178+
enabled?: boolean;
179+
// Memory limit for TypeScript reporter process.
180+
memoryLimit?: number;
181+
// Path to tsconfig.json.
182+
configFile?: string;
183+
configOverwrite?: TypeScriptConfigurationOverwrite;
184+
// The base path for finding files specified in the tsconfig.json. Same as context option from the ts-loader.
185+
context?: string;
186+
// The equivalent of the `--build` flag from the `tsc`.
187+
build?: boolean;
188+
// `readonly` keeps all emitted files in memory,
189+
// `write-tsbuildinfo` which writes only .tsbuildinfo files,
190+
// `write-dts` writes .tsbuildinfo and type definition files,
191+
// and `write-references` which writes both .tsbuildinfo and referenced projects output
192+
mode?: 'readonly' | 'write-tsbuildinfo' | 'write-dts' | 'write-references';
193+
// Types of diagnostics to be reported.
194+
diagnosticOptions?: Partial<TypeScriptDiagnosticsOptions>;
195+
extensions?: {
196+
vue?: TypeScriptVueExtensionOptions;
197+
};
198+
profile?: boolean;
199+
typescriptPath?: string;
200+
};
201+
interface TypeScriptDiagnosticsOptions {
202+
syntactic: boolean;
203+
semantic: boolean;
204+
declaration: boolean;
205+
global: boolean;
206+
}
207+
type TypeScriptVueExtensionOptions =
208+
| boolean
209+
| {
210+
// Enable TypeScript Vue extension.
211+
enabled?: boolean;
212+
// Custom vue-template-compiler package.
213+
compiler?: string;
214+
};
215+
216+
type EsLintReporterOptions = {
217+
files: string | string[];
218+
enabled?: boolean;
219+
memoryLimit?: number;
220+
options?: CLIEngineOptions;
221+
};
222+
223+
type FormatterOptions = FormatterType | ComplexFormatterPreferences;
224+
type FormatterType = NotConfigurableFormatterType | ConfigurableFormatterType;
225+
type NotConfigurableFormatterType = undefined | 'basic' | Formatter;
226+
type ConfigurableFormatterType = 'codeframe';
227+
type Formatter = (issue: Issue) => string;
228+
type ComplexFormatterPreferences<T extends FormatterType = FormatterType> = {
229+
type: T;
230+
options?: ConfigurableFormatterType<T>;
231+
};
232+
233+
interface IssueOptions {
234+
include?: IssuePredicateOption;
235+
exclude?: IssuePredicateOption;
236+
}
237+
type IssuePredicateOption = IssuePredicate | IssueMatch | (IssuePredicate | IssueMatch)[];
238+
type IssuePredicate = (issue: Issue) => boolean;
239+
type IssueMatch = Partial<Pick<Issue, 'origin' | 'severity' | 'code' | 'file'>>;
240+
interface Issue {
241+
origin: string;
242+
severity: IssueSeverity;
243+
code: string;
244+
message: string;
245+
file?: string;
246+
location?: IssueLocation;
247+
}
248+
249+
type LoggerOptions = {
250+
infrastructure?: LoggerType | Logger;
251+
issues?: LoggerType | Logger;
252+
devServer?: boolean;
253+
};
254+
```
255+
141256
### ignoreNotFoundWarnings
142257

143258
> Enables suppress not found typescript warnings.

0 commit comments

Comments
 (0)