File tree Expand file tree Collapse file tree 7 files changed +13
-11
lines changed Expand file tree Collapse file tree 7 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -13327,7 +13327,9 @@ namespace ts {
13327
13327
childrenTypes.push(checkExpression(child, checkMode));
13328
13328
}
13329
13329
}
13330
- childrenPropSymbol.type = getUnionType(childrenTypes, /*subtypeReduction*/ false);
13330
+ childrenPropSymbol.type = childrenTypes.length === 1 ?
13331
+ childrenTypes[0] :
13332
+ createArrayType(getUnionType(childrenTypes, /*subtypeReduction*/ false));
13331
13333
attributesTable.set(jsxChildrenPropertyName, childrenPropSymbol);
13332
13334
containsSynthesizedJsxChildren = true;
13333
13335
}
Original file line number Diff line number Diff line change @@ -2457,7 +2457,7 @@ namespace ts {
2457
2457
let indentation : number ;
2458
2458
for ( const line of lines ) {
2459
2459
for ( let i = 0 ; i < line . length && ( indentation === undefined || i < indentation ) ; i ++ ) {
2460
- if ( ! isWhiteSpace ( line . charCodeAt ( i ) ) ) {
2460
+ if ( ! isWhiteSpaceLike ( line . charCodeAt ( i ) ) ) {
2461
2461
if ( indentation === undefined || i < indentation ) {
2462
2462
indentation = i ;
2463
2463
break ;
Original file line number Diff line number Diff line change @@ -366,7 +366,7 @@ namespace ts {
366
366
return computeLineAndCharacterOfPosition ( getLineStarts ( sourceFile ) , position ) ;
367
367
}
368
368
369
- export function isWhiteSpace ( ch : number ) : boolean {
369
+ export function isWhiteSpaceLike ( ch : number ) : boolean {
370
370
return isWhiteSpaceSingleLine ( ch ) || isLineBreak ( ch ) ;
371
371
}
372
372
@@ -510,7 +510,7 @@ namespace ts {
510
510
break ;
511
511
512
512
default :
513
- if ( ch > CharacterCodes . maxAsciiCharacter && ( isWhiteSpace ( ch ) ) ) {
513
+ if ( ch > CharacterCodes . maxAsciiCharacter && ( isWhiteSpaceLike ( ch ) ) ) {
514
514
pos ++ ;
515
515
continue ;
516
516
}
@@ -691,7 +691,7 @@ namespace ts {
691
691
}
692
692
break scan;
693
693
default :
694
- if ( ch > CharacterCodes . maxAsciiCharacter && ( isWhiteSpace ( ch ) ) ) {
694
+ if ( ch > CharacterCodes . maxAsciiCharacter && ( isWhiteSpaceLike ( ch ) ) ) {
695
695
if ( hasPendingCommentRange && isLineBreak ( ch ) ) {
696
696
pendingHasTrailingNewLine = true ;
697
697
}
@@ -1750,7 +1750,7 @@ namespace ts {
1750
1750
if ( isLineBreak ( char ) && firstNonWhitespace === 0 ) {
1751
1751
firstNonWhitespace = - 1 ;
1752
1752
}
1753
- else if ( ! isWhiteSpaceSingleLine ( char ) ) {
1753
+ else if ( ! isWhiteSpaceLike ( char ) ) {
1754
1754
firstNonWhitespace = pos ;
1755
1755
}
1756
1756
pos ++ ;
Original file line number Diff line number Diff line change 1572
1572
}
1573
1573
1574
1574
export interface JsxText extends Node {
1575
- kind : SyntaxKind . JsxText ,
1576
- containsOnlyWhiteSpaces : boolean ,
1575
+ kind : SyntaxKind . JsxText ;
1576
+ containsOnlyWhiteSpaces : boolean ;
1577
1577
parent ?: JsxElement ;
1578
1578
}
1579
1579
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ namespace ts.formatting {
54
54
let current = position ;
55
55
while ( current > 0 ) {
56
56
const char = sourceFile . text . charCodeAt ( current ) ;
57
- if ( ! isWhiteSpace ( char ) ) {
57
+ if ( ! isWhiteSpaceLike ( char ) ) {
58
58
break ;
59
59
}
60
60
current -- ;
Original file line number Diff line number Diff line change @@ -608,7 +608,7 @@ namespace ts.textChanges {
608
608
if ( force || ! isTrivia ( s ) ) {
609
609
this . lastNonTriviaPosition = this . writer . getTextPos ( ) ;
610
610
let i = 0 ;
611
- while ( isWhiteSpace ( s . charCodeAt ( s . length - i - 1 ) ) ) {
611
+ while ( isWhiteSpaceLike ( s . charCodeAt ( s . length - i - 1 ) ) ) {
612
612
i ++ ;
613
613
}
614
614
// trim trailing whitespaces
Original file line number Diff line number Diff line change @@ -1381,7 +1381,7 @@ namespace ts {
1381
1381
}
1382
1382
1383
1383
export function getFirstNonSpaceCharacterPosition ( text : string , position : number ) {
1384
- while ( isWhiteSpace ( text . charCodeAt ( position ) ) ) {
1384
+ while ( isWhiteSpaceLike ( text . charCodeAt ( position ) ) ) {
1385
1385
position += 1 ;
1386
1386
}
1387
1387
return position ;
You can’t perform that action at this time.
0 commit comments