pub struct CheckerOptions {Show 36 fields
pub strict: bool,
pub no_implicit_any: bool,
pub no_implicit_returns: bool,
pub strict_null_checks: bool,
pub strict_function_types: bool,
pub strict_property_initialization: bool,
pub no_implicit_this: bool,
pub use_unknown_in_catch_variables: bool,
pub isolated_modules: bool,
pub no_unchecked_indexed_access: bool,
pub strict_bind_call_apply: bool,
pub exact_optional_property_types: bool,
pub no_lib: bool,
pub no_types_and_symbols: bool,
pub target: ScriptTarget,
pub module: ModuleKind,
pub es_module_interop: bool,
pub allow_synthetic_default_imports: bool,
pub allow_unreachable_code: Option<bool>,
pub no_property_access_from_index_signature: bool,
pub sound_mode: bool,
pub experimental_decorators: bool,
pub no_unused_locals: bool,
pub no_unused_parameters: bool,
pub always_strict: bool,
pub resolve_json_module: bool,
pub check_js: bool,
pub no_resolve: bool,
pub no_unchecked_side_effect_imports: bool,
pub no_implicit_override: bool,
pub jsx_factory: String,
pub jsx_fragment_factory: String,
pub jsx_mode: JsxMode,
pub module_explicitly_set: bool,
pub suppress_excess_property_errors: bool,
pub suppress_implicit_any_index_errors: bool,
}Expand description
Compiler options for type checking.
Fields§
§strict: bool§no_implicit_any: bool§no_implicit_returns: bool§strict_null_checks: bool§strict_function_types: bool§strict_property_initialization: bool§no_implicit_this: bool§use_unknown_in_catch_variables: bool§isolated_modules: bool§no_unchecked_indexed_access: boolWhen true, indexed access with index signatures adds | undefined to the type
strict_bind_call_apply: boolWhen true, checking bind/call/apply uses strict function signatures
exact_optional_property_types: boolWhen true, optional properties are treated as exactly T | undefined not T | undefined | missing
no_lib: boolWhen true, no library files (including lib.d.ts) are included. This corresponds to the –noLib compiler flag. TS2318 errors are emitted when referencing global types with this option enabled.
no_types_and_symbols: boolWhen true, do not automatically inject built-in type declarations. This corresponds to the –noTypesAndSymbols compiler flag. Prevents loading default lib.d.ts files which provide types like Array, Object, etc.
target: ScriptTargetTarget ECMAScript version (ES3, ES5, ES2015, ES2016, etc.) Controls which built-in types are available (e.g., Promise requires ES2015) Defaults to ES3 for maximum compatibility
module: ModuleKindModule kind (None, CommonJS, ES2015, ES2020, ES2022, ESNext, etc.)
Controls which module system is being targeted (affects import/export syntax validity)
es_module_interop: boolEmit additional JavaScript to ease support for importing CommonJS modules.
When true, synthesizes default exports for CommonJS modules.
allow_synthetic_default_imports: boolAllow ‘import x from y’ when a module doesn’t have a default export. Implied by esModuleInterop.
allow_unreachable_code: Option<bool>Controls reporting of unreachable code (TS7027).
None(default): tsc emits TS7027 as a suggestion, not an errorSome(false): tsc emits TS7027 as an errorSome(true): tsc does not emit TS7027 at all
no_property_access_from_index_signature: boolWhen true, require bracket notation for index signature property access (TS4111).
sound_mode: boolWhen true, enable Sound Mode for stricter type checking beyond TypeScript’s defaults. Sound Mode catches common unsoundness issues like:
- Mutable array covariance (TS9002)
- Method parameter bivariance (TS9003)
anyescapes (TS9004)- Excess properties via sticky freshness (TS9001)
Activated via: --sound CLI flag or // @tsz-sound pragma
experimental_decorators: boolWhen true, enables experimental support for decorators (legacy decorators).
This is required for the @experimentalDecorators flag.
When decorators are used, TypedPropertyDescriptor must be available.
no_unused_locals: boolWhen true, report errors for unused local variables (TS6133).
no_unused_parameters: boolWhen true, report errors for unused function parameters (TS6133).
always_strict: boolWhen true, parse in strict mode and emit “use strict” for each source file. Enables TS1100 for invalid use of ‘arguments’ in strict mode.
resolve_json_module: boolWhen true, allows importing JSON files with .json extension.
When false, importing JSON files emits TS2732 suggesting to enable this flag.
check_js: boolWhen true, enable type checking in JavaScript files. This corresponds to the –checkJs compiler flag. With checkJs enabled, noImplicitAny and other type errors apply to .js files.
no_resolve: boolWhen true, disable dependency expansion from imports and triple-slash references.
no_unchecked_side_effect_imports: boolWhen true, check side-effect imports for module resolution errors (TS2882).
no_implicit_override: boolWhen true, require ‘override’ modifier on members that override base class members (TS4114).
jsx_factory: StringJSX factory function (e.g. React.createElement)
jsx_fragment_factory: StringJSX fragment factory function (e.g. React.Fragment)
jsx_mode: JsxModeJSX emit mode (preserve, react, react-jsx, react-jsxdev, react-native). Only “react” (classic transform) requires the factory to be in scope.
module_explicitly_set: boolWhether the module option was explicitly set by the user (via tsconfig or CLI).
When false, the module kind was computed from defaults (e.g. based on target).
tsc only emits TS1202 (import assignment in ESM) when module is explicitly set.
suppress_excess_property_errors: boolWhen true, suppress TS2353 (excess property) errors. This is a removed option (TS5102) but tsc still honors its suppression behavior.
suppress_implicit_any_index_errors: boolWhen true, suppress TS7053 (implicit any index) errors. This is a removed option (TS5102) but tsc still honors its suppression behavior.
Implementations§
Source§impl CheckerOptions
impl CheckerOptions
Sourcepub const fn apply_strict_defaults(self) -> CheckerOptions
pub const fn apply_strict_defaults(self) -> CheckerOptions
Apply TypeScript’s --strict defaults to individual strict flags.
In tsc, enabling strict turns on the strict family unless explicitly disabled.
We mirror that behavior by OR-ing the per-flag booleans with strict.
Trait Implementations§
Source§impl Clone for CheckerOptions
impl Clone for CheckerOptions
Source§fn clone(&self) -> CheckerOptions
fn clone(&self) -> CheckerOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CheckerOptions
impl Debug for CheckerOptions
Source§impl Default for CheckerOptions
impl Default for CheckerOptions
Source§fn default() -> CheckerOptions
fn default() -> CheckerOptions
Auto Trait Implementations§
impl Freeze for CheckerOptions
impl RefUnwindSafe for CheckerOptions
impl Send for CheckerOptions
impl Sync for CheckerOptions
impl Unpin for CheckerOptions
impl UnsafeUnpin for CheckerOptions
impl UnwindSafe for CheckerOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more