diff --git a/crates/printer/src/operation_type_printer/type_printer.rs b/crates/printer/src/operation_type_printer/type_printer.rs index 399aba0..0b8537e 100644 --- a/crates/printer/src/operation_type_printer/type_printer.rs +++ b/crates/printer/src/operation_type_printer/type_printer.rs @@ -9,14 +9,13 @@ use itertools::{Either, Itertools}; use nitrogql_ast::{ base::Pos, directive::Directive, - operation::{FragmentDefinition, OperationDocument}, + operation::FragmentDefinition, selection_set::{Selection, SelectionSet}, value::Value, variable::VariablesDefinition, }; use nitrogql_config_file::TypeTarget; use nitrogql_semantics::direct_fields_of_output_type; -use sourcemap_writer::SourceMapWriter; use super::{ super::ts_types::{ts_types_util::ts_intersection, TSType}, @@ -33,18 +32,9 @@ use super::{ pub struct QueryTypePrinterContext<'a, 'src, S: Text<'src>> { pub options: &'a OperationTypePrinterOptions, pub schema: &'a Schema, - pub operation: &'a OperationDocument<'src>, pub fragment_definitions: &'a HashMap<&'src str, &'a FragmentDefinition<'src>>, } -pub trait TypePrinter<'src, S: Text<'src>> { - fn print_type( - &self, - options: &QueryTypePrinterContext<'_, 'src, S>, - writer: &mut impl SourceMapWriter, - ); -} - pub fn get_type_for_selection_set<'src, S: Text<'src>>( context: &QueryTypePrinterContext<'_, 'src, S>, selection_set: &SelectionSet<'src>, diff --git a/crates/printer/src/operation_type_printer/visitor.rs b/crates/printer/src/operation_type_printer/visitor.rs index 0c325f2..d9313cc 100644 --- a/crates/printer/src/operation_type_printer/visitor.rs +++ b/crates/printer/src/operation_type_printer/visitor.rs @@ -115,7 +115,6 @@ where .collect(); let context = OperationTypePrinterContext { schema, - operation, fragment_definitions, }; Self { options, context } @@ -124,7 +123,6 @@ where pub struct OperationTypePrinterContext<'a, 'src, S: Text<'src>> { pub schema: &'a Schema, - pub operation: &'a OperationDocument<'src>, pub fragment_definitions: HashMap<&'src str, &'a FragmentDefinition<'src>>, } @@ -167,7 +165,6 @@ impl OperationPrinterVisitor for OperationTypePrinterVisitor<'_, '_> { let type_printer_context = QueryTypePrinterContext { options: &self.options, schema: self.context.schema, - operation: self.context.operation, fragment_definitions: &self.context.fragment_definitions, }; @@ -267,7 +264,6 @@ impl OperationPrinterVisitor for OperationTypePrinterVisitor<'_, '_> { let type_printer_context = QueryTypePrinterContext { options: &self.options, schema: self.context.schema, - operation: self.context.operation, fragment_definitions: &self.context.fragment_definitions, }; diff --git a/crates/printer/src/schema_type_printer/context.rs b/crates/printer/src/schema_type_printer/context.rs index b8c64f5..6c93075 100644 --- a/crates/printer/src/schema_type_printer/context.rs +++ b/crates/printer/src/schema_type_printer/context.rs @@ -15,7 +15,6 @@ use crate::SchemaTypePrinterOptions; pub struct SchemaTypePrinterContext<'src> { pub options: &'src SchemaTypePrinterOptions, - pub document: &'src TypeSystemDocument<'src>, pub schema: &'src Schema, Pos>, // Mapping from Scalar name to TypeScript types. pub scalar_types: HashMap, @@ -36,7 +35,6 @@ impl SchemaTypePrinterContext<'_> { let local_type_names = make_local_type_names(document, &scalar_types); SchemaTypePrinterContext { options, - document, schema, scalar_types, local_type_names,