fix(typescript): ArrowFunctionExpression needs parens in TSAsExpression (#1541)
parent
5fd9cd01de
commit
e22bd00815
|
@ -515,6 +515,7 @@ FPp.needsParens = function() {
|
|||
case "MemberExpression":
|
||||
return name === "object";
|
||||
|
||||
case "TSAsExpression":
|
||||
case "BindExpression":
|
||||
case "TaggedTemplateExpression":
|
||||
case "UnaryExpression":
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`asOperatorContextualType.ts 1`] = `
|
||||
// should error
|
||||
var x = (v => v) as (x: number) => string;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// should error
|
||||
var x = (v => v) as (x: number) => string;
|
||||
|
||||
`;
|
|
@ -0,0 +1,2 @@
|
|||
// should error
|
||||
var x = (v => v) as (x: number) => string;
|
|
@ -0,0 +1 @@
|
|||
run_spec(__dirname, { parser: "typescript" });
|
Loading…
Reference in New Issue