parent
3726067923
commit
a2328edced
|
@ -385,7 +385,8 @@ FastPath.prototype.needsParens = function(options) {
|
|||
if (
|
||||
parent.type === "UnaryExpression" ||
|
||||
parent.type === "AwaitExpression" ||
|
||||
parent.type === "TSAsExpression"
|
||||
parent.type === "TSAsExpression" ||
|
||||
parent.type === "TSNonNullExpression"
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -398,6 +399,7 @@ FastPath.prototype.needsParens = function(options) {
|
|||
case "SpreadElement":
|
||||
case "SpreadProperty":
|
||||
case "TSAsExpression":
|
||||
case "TSNonNullExpression":
|
||||
return true;
|
||||
|
||||
case "MemberExpression":
|
||||
|
|
|
@ -3,8 +3,24 @@
|
|||
exports[`parens.ts 1`] = `
|
||||
(a ? b : c) ![tokenKey];
|
||||
(a || b) ![tokenKey];
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
}
|
||||
|
||||
function* g() {
|
||||
return (yield * foo())!;
|
||||
}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
(a ? b : c)![tokenKey];
|
||||
(a || b)![tokenKey];
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
}
|
||||
|
||||
function* g() {
|
||||
return (yield* foo())!;
|
||||
}
|
||||
|
||||
`;
|
||||
|
|
|
@ -1,2 +1,10 @@
|
|||
(a ? b : c) ![tokenKey];
|
||||
(a || b) ![tokenKey];
|
||||
|
||||
async function f() {
|
||||
return (await foo())!;
|
||||
}
|
||||
|
||||
function* g() {
|
||||
return (yield * foo())!;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue