Add ASI protection for TSNonNullExpression (#5262)
parent
dd4687e7ef
commit
c7093cb3e4
|
@ -5461,7 +5461,8 @@ function hasNakedLeftSide(node) {
|
|||
node.type === "SequenceExpression" ||
|
||||
node.type === "TaggedTemplateExpression" ||
|
||||
node.type === "BindExpression" ||
|
||||
(node.type === "UpdateExpression" && !node.prefix)
|
||||
(node.type === "UpdateExpression" && !node.prefix) ||
|
||||
node.type === "TSNonNullExpression"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,3 +49,25 @@ class A {
|
|||
}
|
||||
|
||||
`;
|
||||
|
||||
exports[`non-null.ts - typescript-verify 1`] = `
|
||||
// the 2nd line needs ASI protection
|
||||
const el = ReactDOM.findDOMNode(ref)
|
||||
;(el as HTMLElement)!.style.cursor = 'pointer'
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// the 2nd line needs ASI protection
|
||||
const el = ReactDOM.findDOMNode(ref);
|
||||
(el as HTMLElement)!.style.cursor = "pointer";
|
||||
|
||||
`;
|
||||
|
||||
exports[`non-null.ts - typescript-verify 2`] = `
|
||||
// the 2nd line needs ASI protection
|
||||
const el = ReactDOM.findDOMNode(ref)
|
||||
;(el as HTMLElement)!.style.cursor = 'pointer'
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// the 2nd line needs ASI protection
|
||||
const el = ReactDOM.findDOMNode(ref)
|
||||
;(el as HTMLElement)!.style.cursor = "pointer"
|
||||
|
||||
`;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// the 2nd line needs ASI protection
|
||||
const el = ReactDOM.findDOMNode(ref)
|
||||
;(el as HTMLElement)!.style.cursor = 'pointer'
|
Loading…
Reference in New Issue