Skip to main content

CheckerOptions

Struct CheckerOptions 

Source
pub struct CheckerOptions {
Show 33 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,
}
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: bool

When true, indexed access with index signatures adds | undefined to the type

§strict_bind_call_apply: bool

When true, checking bind/call/apply uses strict function signatures

§exact_optional_property_types: bool

When true, optional properties are treated as exactly T | undefined not T | undefined | missing

§no_lib: bool

When 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: bool

When 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: ScriptTarget

Target 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: ModuleKind

Module kind (None, CommonJS, ES2015, ES2020, ES2022, ESNext, etc.) Controls which module system is being targeted (affects import/export syntax validity)

§es_module_interop: bool

Emit additional JavaScript to ease support for importing CommonJS modules. When true, synthesizes default exports for CommonJS modules.

§allow_synthetic_default_imports: bool

Allow ‘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 error
  • Some(false): tsc emits TS7027 as an error
  • Some(true): tsc does not emit TS7027 at all
§no_property_access_from_index_signature: bool

When true, require bracket notation for index signature property access (TS4111).

§sound_mode: bool

When 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)
  • any escapes (TS9004)
  • Excess properties via sticky freshness (TS9001)

Activated via: --sound CLI flag or // @ts-sound pragma

§experimental_decorators: bool

When 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: bool

When true, report errors for unused local variables (TS6133).

§no_unused_parameters: bool

When true, report errors for unused function parameters (TS6133).

§always_strict: bool

When 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: bool

When true, allows importing JSON files with .json extension. When false, importing JSON files emits TS2732 suggesting to enable this flag.

§check_js: bool

When 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: bool

When true, disable dependency expansion from imports and triple-slash references.

§no_unchecked_side_effect_imports: bool

When true, check side-effect imports for module resolution errors (TS2882).

§no_implicit_override: bool

When true, require ‘override’ modifier on members that override base class members (TS4114).

§jsx_factory: String

JSX factory function (e.g. React.createElement)

§jsx_fragment_factory: String

JSX fragment factory function (e.g. React.Fragment)

§jsx_mode: JsxMode

JSX emit mode (preserve, react, react-jsx, react-jsxdev, react-native). Only “react” (classic transform) requires the factory to be in scope.

Implementations§

Source§

impl CheckerOptions

Source

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

Source§

fn clone(&self) -> CheckerOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CheckerOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for CheckerOptions

Source§

fn default() -> CheckerOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more