pub struct TypeCollectorVisitor {
pub types: FxHashSet<TypeId>,
pub max_depth: usize,
}Expand description
Visitor that collects all TypeIds referenced by a type.
Useful for finding dependencies or tracking type usage.
Fields§
§types: FxHashSet<TypeId>Set of collected type IDs.
max_depth: usizeMaximum depth to traverse.
Implementations§
Source§impl TypeCollectorVisitor
impl TypeCollectorVisitor
Sourcepub fn with_max_depth(max_depth: usize) -> Self
pub fn with_max_depth(max_depth: usize) -> Self
Create a new TypeCollectorVisitor with custom max depth.
Trait Implementations§
Source§impl Default for TypeCollectorVisitor
impl Default for TypeCollectorVisitor
Source§impl TypeVisitor for TypeCollectorVisitor
impl TypeVisitor for TypeCollectorVisitor
Source§fn visit_intrinsic(&mut self, _kind: IntrinsicKind) -> Self::Output
fn visit_intrinsic(&mut self, _kind: IntrinsicKind) -> Self::Output
Visit an intrinsic type (any, unknown, never, void, etc.).
Source§fn visit_literal(&mut self, _value: &LiteralValue) -> Self::Output
fn visit_literal(&mut self, _value: &LiteralValue) -> Self::Output
Visit a literal type (string, number, boolean, bigint literals).
Source§fn visit_array(&mut self, element_type: TypeId) -> Self::Output
fn visit_array(&mut self, element_type: TypeId) -> Self::Output
Visit an array type T[].
Source§fn visit_index_access(
&mut self,
object_type: TypeId,
key_type: TypeId,
) -> Self::Output
fn visit_index_access( &mut self, object_type: TypeId, key_type: TypeId, ) -> Self::Output
Visit an indexed access type T[K].
Source§fn visit_keyof(&mut self, type_id: TypeId) -> Self::Output
fn visit_keyof(&mut self, type_id: TypeId) -> Self::Output
Visit a keyof type.
Source§fn visit_readonly_type(&mut self, inner_type: TypeId) -> Self::Output
fn visit_readonly_type(&mut self, inner_type: TypeId) -> Self::Output
Visit a readonly type modifier.
Source§fn visit_string_intrinsic(
&mut self,
_kind: StringIntrinsicKind,
type_arg: TypeId,
) -> Self::Output
fn visit_string_intrinsic( &mut self, _kind: StringIntrinsicKind, type_arg: TypeId, ) -> Self::Output
Visit a string manipulation intrinsic type.
Source§fn visit_enum(&mut self, _def_id: u32, member_type: TypeId) -> Self::Output
fn visit_enum(&mut self, _def_id: u32, member_type: TypeId) -> Self::Output
Visit an enum type with nominal identity and structural member types.
Source§fn default_output() -> Self::Output
fn default_output() -> Self::Output
Default output for unimplemented variants.
Source§fn visit_object(&mut self, _shape_id: u32) -> Self::Output
fn visit_object(&mut self, _shape_id: u32) -> Self::Output
Visit an object type with properties.
Source§fn visit_object_with_index(&mut self, _shape_id: u32) -> Self::Output
fn visit_object_with_index(&mut self, _shape_id: u32) -> Self::Output
Visit an object type with index signatures.
Source§fn visit_union(&mut self, _list_id: u32) -> Self::Output
fn visit_union(&mut self, _list_id: u32) -> Self::Output
Visit a union type (A | B | C).
Source§fn visit_intersection(&mut self, _list_id: u32) -> Self::Output
fn visit_intersection(&mut self, _list_id: u32) -> Self::Output
Visit an intersection type (A & B & C).
Source§fn visit_tuple(&mut self, _list_id: u32) -> Self::Output
fn visit_tuple(&mut self, _list_id: u32) -> Self::Output
Visit a tuple type [T, U, V].
Source§fn visit_function(&mut self, _shape_id: u32) -> Self::Output
fn visit_function(&mut self, _shape_id: u32) -> Self::Output
Visit a function type.
Source§fn visit_callable(&mut self, _shape_id: u32) -> Self::Output
fn visit_callable(&mut self, _shape_id: u32) -> Self::Output
Visit a callable type with call/construct signatures.
Source§fn visit_type_parameter(&mut self, _param_info: &TypeParamInfo) -> Self::Output
fn visit_type_parameter(&mut self, _param_info: &TypeParamInfo) -> Self::Output
Visit a type parameter (generic type variable).
Source§fn visit_bound_parameter(&mut self, _de_bruijn_index: u32) -> Self::Output
fn visit_bound_parameter(&mut self, _de_bruijn_index: u32) -> Self::Output
Visit a bound type parameter using De Bruijn index for alpha-equivalence. Read more
Source§fn visit_ref(&mut self, _symbol_ref: u32) -> Self::Output
fn visit_ref(&mut self, _symbol_ref: u32) -> Self::Output
Visit a named type reference (interface, class, type alias).
Source§fn visit_lazy(&mut self, _def_id: u32) -> Self::Output
fn visit_lazy(&mut self, _def_id: u32) -> Self::Output
Visit a lazy type reference using
DefId.Source§fn visit_recursive(&mut self, _de_bruijn_index: u32) -> Self::Output
fn visit_recursive(&mut self, _de_bruijn_index: u32) -> Self::Output
Visit a recursive type reference using De Bruijn index. Read more
Source§fn visit_application(&mut self, _app_id: u32) -> Self::Output
fn visit_application(&mut self, _app_id: u32) -> Self::Output
Visit a generic type application Base.
Source§fn visit_conditional(&mut self, _cond_id: u32) -> Self::Output
fn visit_conditional(&mut self, _cond_id: u32) -> Self::Output
Visit a conditional type T extends U ? X : Y.
Source§fn visit_mapped(&mut self, _mapped_id: u32) -> Self::Output
fn visit_mapped(&mut self, _mapped_id: u32) -> Self::Output
Visit a mapped type { [K in Keys]: V }.
Source§fn visit_template_literal(&mut self, _template_id: u32) -> Self::Output
fn visit_template_literal(&mut self, _template_id: u32) -> Self::Output
Visit a template literal type
hello${x}world.Source§fn visit_type_query(&mut self, _symbol_ref: u32) -> Self::Output
fn visit_type_query(&mut self, _symbol_ref: u32) -> Self::Output
Visit a type query (typeof expr).
Source§fn visit_unique_symbol(&mut self, _symbol_ref: u32) -> Self::Output
fn visit_unique_symbol(&mut self, _symbol_ref: u32) -> Self::Output
Visit a unique symbol type.
Source§fn visit_infer(&mut self, _param_info: &TypeParamInfo) -> Self::Output
fn visit_infer(&mut self, _param_info: &TypeParamInfo) -> Self::Output
Visit an infer type (for type inference in conditional types).
Source§fn visit_this_type(&mut self) -> Self::Output
fn visit_this_type(&mut self) -> Self::Output
Visit a this type (polymorphic this parameter).
Source§fn visit_error(&mut self) -> Self::Output
fn visit_error(&mut self) -> Self::Output
Visit an error type.
Source§fn visit_no_infer(&mut self, _inner: TypeId) -> Self::Output
fn visit_no_infer(&mut self, _inner: TypeId) -> Self::Output
Visit a type (TypeScript 5.4+).
Traverses the inner type (
NoInferNoInfer is transparent for traversal).Source§fn visit_module_namespace(&mut self, _symbol_ref: u32) -> Self::Output
fn visit_module_namespace(&mut self, _symbol_ref: u32) -> Self::Output
Visit a module namespace type (import * as ns).
Source§fn visit_type(
&mut self,
types: &dyn TypeDatabase,
type_id: TypeId,
) -> Self::Output
fn visit_type( &mut self, types: &dyn TypeDatabase, type_id: TypeId, ) -> Self::Output
Visit a type by dispatching to the appropriate method. Read more
Source§fn visit_type_key(
&mut self,
_types: &dyn TypeDatabase,
type_key: &TypeData,
) -> Self::Output
fn visit_type_key( &mut self, _types: &dyn TypeDatabase, type_key: &TypeData, ) -> Self::Output
Visit a
TypeData by dispatching to the appropriate method.Auto Trait Implementations§
impl Freeze for TypeCollectorVisitor
impl RefUnwindSafe for TypeCollectorVisitor
impl Send for TypeCollectorVisitor
impl Sync for TypeCollectorVisitor
impl Unpin for TypeCollectorVisitor
impl UnsafeUnpin for TypeCollectorVisitor
impl UnwindSafe for TypeCollectorVisitor
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
Mutably borrows from an owned value. Read more