feat(prettier) TSInferType, TSIndexAccessType (#1390)

This commit is contained in:
Cameron 2023-11-18 01:22:37 +00:00 committed by GitHub
parent 7ed067ec28
commit ba57544b6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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