Add parenthesis around arrow functions in a cast (#1689)

master
Christopher Chedeau 2017-05-23 16:30:47 -07:00 committed by GitHub
parent 474eed0ecb
commit 7ab73e688d
3 changed files with 6 additions and 2 deletions

View File

@ -550,6 +550,7 @@ FPp.needsParens = function() {
case "LogicalExpression": case "LogicalExpression":
case "BinaryExpression": case "BinaryExpression":
case "AwaitExpression": case "AwaitExpression":
case "TSTypeAssertionExpression":
return true; return true;
case "ConditionalExpression": case "ConditionalExpression":

View File

@ -1,8 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`parenthesis.ts 1`] = ` exports[`parenthesis.ts 1`] = `
<DocumentHighlightKind>(a ? b : c) <DocumentHighlightKind>(a ? b : c);
<any>(() => {});
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<DocumentHighlightKind>(a ? b : c); <DocumentHighlightKind>(a ? b : c);
<any>(() => {});
`; `;

View File

@ -1 +1,2 @@
<DocumentHighlightKind>(a ? b : c) <DocumentHighlightKind>(a ? b : c);
<any>(() => {});