diff --git a/crates/oxc_query/src/adapter.rs b/crates/oxc_query/src/adapter.rs index cf0b03ac1..9fc8e60a0 100644 --- a/crates/oxc_query/src/adapter.rs +++ b/crates/oxc_query/src/adapter.rs @@ -106,6 +106,11 @@ impl<'a, 'b: 'a> trustfall::provider::Adapter<'a> for &'a Adapter<'b> { property_name.as_ref(), resolve_info, ), + "InterfaceAST" | "Interface" => super::properties::resolve_interface_property( + contexts, + property_name.as_ref(), + resolve_info, + ), "InterfaceExtend" => super::properties::resolve_interface_extend_property( contexts, property_name.as_ref(), diff --git a/crates/oxc_query/src/properties.rs b/crates/oxc_query/src/properties.rs index c38bacad6..e22e6376e 100644 --- a/crates/oxc_query/src/properties.rs +++ b/crates/oxc_query/src/properties.rs @@ -228,6 +228,23 @@ pub(super) fn resolve_import_property<'a, 'b: 'a>( } } +pub(super) fn resolve_interface_property<'a, 'b: 'a>( + contexts: ContextIterator<'a, Vertex<'b>>, + property_name: &str, + _resolve_info: &ResolveInfo, +) -> ContextOutcomeIterator<'a, Vertex<'b>, FieldValue> { + match property_name { + "name" => resolve_property_with(contexts, |v| { + v.as_interface().unwrap().interface.id.name.to_string().into() + }), + _ => { + unreachable!( + "attempted to read unexpected property '{property_name}' on type 'InterfaceExtend'" + ) + } + } +} + pub(super) fn resolve_interface_extend_property<'a, 'b: 'a>( contexts: ContextIterator<'a, Vertex<'b>>, property_name: &str, diff --git a/crates/oxc_query/src/schema.graphql b/crates/oxc_query/src/schema.graphql index ba275296d..e49b65799 100644 --- a/crates/oxc_query/src/schema.graphql +++ b/crates/oxc_query/src/schema.graphql @@ -201,6 +201,7 @@ interface InterfaceExtend { } interface Interface { + name: String! extend: [InterfaceExtend!]! name_span: Span! entire_span: Span! @@ -355,6 +356,7 @@ type TypeAnnotationAST implements TypeAnnotation & ASTNode & HasSpan { } type InterfaceAST implements Interface & ASTNode & HasSpan { + name: String! extend: [InterfaceExtend!]! name_span: Span! entire_span: Span!