From ba57544b6e000016020e42bf8c9bd80bf308837e Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 18 Nov 2023 01:22:37 +0000 Subject: [PATCH] feat(prettier) TSInferType, TSIndexAccessType (#1390) --- crates/oxc_prettier/src/format/mod.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/oxc_prettier/src/format/mod.rs b/crates/oxc_prettier/src/format/mod.rs index 36d3a2d57..79eb6fa0f 100644 --- a/crates/oxc_prettier/src/format/mod.rs +++ b/crates/oxc_prettier/src/format/mod.rs @@ -653,13 +653,18 @@ impl<'a> Format<'a> for TSImportType<'a> { impl<'a> Format<'a> for TSIndexedAccessType<'a> { fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> { - Doc::Line + let mut parts = p.vec(); + parts.push(format!(p, self.object_type)); + parts.push(ss!("[")); + parts.push(format!(p, self.index_type)); + parts.push(ss!("]")); + Doc::Array(parts) } } impl<'a> Format<'a> for TSInferType<'a> { fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> { - Doc::Line + array!(p, ss!("infer "), format!(p, self.type_parameter)) } } @@ -780,6 +785,12 @@ impl<'a> Format<'a> for TSImportEqualsDeclaration<'a> { } } +impl<'a> Format<'a> for TSTypeParameter<'a> { + fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> { + Doc::Line + } +} + impl<'a> Format<'a> for TSTypeParameterDeclaration<'a> { fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> { Doc::Line