Options References
Compiler Options
Options of TypeScript Compiler Options.
TwoSlash comes with a set of default compiler options that can be found here.
Handbook Options
Check the type definition for the full list of options.
errors
TypeScript error codes to be presented in the code. Use spaces to separate multiple error codes.
const str: string = 1Type 'number' is not assignable to type 'string'.str = 'Hello'Cannot assign to 'str' because it is a constant.
// @errors: 2322 2588
const str: string = 1
str = 'Hello'
noErrors
Suppress all errors in the code. You can also provide error codes to suppress specific errors.
const str: string = 1
str = 'Hello'
// @noErrors
const str: string = 1
str = 'Hello'
noErrorsCutted
Ignore errors that occurred in the cutted code.
const hello = 'world'
// @noErrorsCutted
const hello = 'world'
// ---cut-after---
hello = 'hi' // Supposed to be an error, but ignored because it's cutted.
noErrorValidation
Disable error validation, the errors will still be rendered but Twoslash will not throw to guard against errors in the code.
const str: string = 1Type 'number' is not assignable to type 'string'.
// @noErrorValidation
const str: string = 1
keepNotations
Tell Twoslash to not remove any notations, and keep the original code untouched. The nodes
will have the position information of the original code. Useful for better source mapping combing with meta.removals
.
// @keepNotations
// @module: esnext
// @errors: 2322
const str: string = 1Type 'number' is not assignable to type 'string'.
// @keepNotations
// @module: esnext
// @errors: 2322
const str: string = 1
showEmit
Learn more in the Showing the Emitted Files section.
showEmittedFile
Learn more in the Showing the Emitted Files section.