fix(prettier): Private Field Expression (#1459)

This commit is contained in:
magic-akari 2023-11-20 23:32:16 +08:00 committed by GitHub
parent 5aca375a94
commit f81f15ff71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1322,10 +1322,7 @@ impl<'a> Format<'a> for PrivateFieldExpression<'a> {
fn format(&self, p: &mut Prettier<'a>) -> Doc<'a> {
let mut parts = p.vec();
parts.push(format!(p, self.object));
if self.optional {
parts.push(ss!("?."));
}
parts.push(ss!("#"));
parts.push(if self.optional { ss!("?.") } else { ss!(".") });
parts.push(format!(p, self.field));
Doc::Array(parts)
}