Struct stc_ts_file_analyzer::analyzer::generic::inference::InferTypeOpts
source · [−]pub(crate) struct InferTypeOpts {
pub priority: InferencePriority,
pub for_fn_assignment: bool,
pub append_type_as_union: bool,
pub use_error: bool,
pub is_type_ann: bool,
pub ignore_builtin_object_interface: bool,
pub skip_initial_union_check: bool,
pub is_inferring_rest_type: bool,
pub exclude_null_and_undefined: bool,
pub index_tuple_with_param: bool,
pub rest_type_index: Option<usize>,
}
Expand description
Default
All fields default to false
.
Fields
priority: InferencePriority
for_fn_assignment: bool
append_type_as_union: bool
Defaults to false because
function foo<T>(x: T, y: T) {
return x;
}
foo(1, '')
the code above is error.
This is true
for array
use_error: bool
If true, inference result can be unknown
.
is_type_ann: bool
If we are inferring a type using another type, we should
- Prevent generalization of literals.
because literals are present in the another type.
ignore_builtin_object_interface: bool
Ignore Object
builtin type.
skip_initial_union_check: bool
is_inferring_rest_type: bool
If true, we are inferring a type from Type::Rest
exclude_null_and_undefined: bool
index_tuple_with_param: bool
rest_type_index: Option<usize>
If this value is different, is_inferring_rest_type
behaves
differently, to avoid inferring ([...T], [...T])
& (['a', 'b'], ['c', ['d'])
as a tuple with 4 elements.
Trait Implementations
sourceimpl Clone for InferTypeOpts
impl Clone for InferTypeOpts
sourcefn clone(&self) -> InferTypeOpts
fn clone(&self) -> InferTypeOpts
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for InferTypeOpts
impl Debug for InferTypeOpts
sourceimpl Default for InferTypeOpts
impl Default for InferTypeOpts
sourcefn default() -> InferTypeOpts
fn default() -> InferTypeOpts
Returns the “default value” for a type. Read more
impl Copy for InferTypeOpts
Auto Trait Implementations
impl RefUnwindSafe for InferTypeOpts
impl Send for InferTypeOpts
impl Sync for InferTypeOpts
impl Unpin for InferTypeOpts
impl UnwindSafe for InferTypeOpts
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more