Use ?. where it represents the intended semantics (#11512)

This commit is contained in:
Nicolò Ribaudo
2020-05-09 23:31:50 +02:00
committed by GitHub
parent aeb51f463c
commit 31b361b736
47 changed files with 99 additions and 118 deletions

View File

@@ -21,7 +21,7 @@ export function BlockStatement(node: Object) {
this.token("{");
this.printInnerComments(node);
const hasDirectives = node.directives && node.directives.length;
const hasDirectives = node.directives?.length;
if (node.body.length || hasDirectives) {
this.newline();

View File

@@ -147,7 +147,7 @@ export function ImportDeclaration(node: Object) {
}
const specifiers = node.specifiers.slice(0);
if (specifiers && specifiers.length) {
if (specifiers?.length) {
// print "special" specifiers first
for (;;) {
const first = specifiers[0];