Convert to async function: handle type arguments to then/catch (#37463)

* Handle type arguments to then/catch

* Keep single-line types on a single line
This commit is contained in:
Andrew Branch
2020-03-24 08:56:47 -08:00
committed by GitHub
parent 9f296ce96d
commit 37569d01f6
8 changed files with 207 additions and 28 deletions

View File

@@ -4296,7 +4296,7 @@ namespace ts {
// JsxText will be written with its leading whitespace, so don't add more manually.
return 0;
}
if (!positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(firstChild) && firstChild.parent === parentNode) {
if (!positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(firstChild) && (!firstChild.parent || firstChild.parent === parentNode)) {
if (preserveSourceNewlines) {
return getEffectiveLines(
includeComments => getLinesBetweenPositionAndPrecedingNonWhitespaceCharacter(
@@ -4353,7 +4353,7 @@ namespace ts {
if (lastChild === undefined) {
return rangeIsOnSingleLine(parentNode, currentSourceFile!) ? 0 : 1;
}
if (!positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(lastChild) && lastChild.parent === parentNode) {
if (!positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
if (preserveSourceNewlines) {
return getEffectiveLines(
includeComments => getLinesBetweenPositionAndNextNonWhitespaceCharacter(