@@ -349,7 +349,7 @@ namespace ts {
349
349
// The presence of a particular fact means that the given test is true for some (and possibly all) values
350
350
// of that kind of type.
351
351
BaseStringStrictFacts = TypeofEQString | TypeofNENumber | TypeofNEBoolean | TypeofNESymbol | TypeofNEObject | TypeofNEFunction | TypeofNEHostObject | NEUndefined | NENull | NEUndefinedOrNull,
352
- BaseStringFacts = BaseStringStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy,
352
+ BaseStringFacts = BaseStringStrictFacts | EQUndefined | EQNull | EQUndefinedOrNull | Falsy,
353
353
StringStrictFacts = BaseStringStrictFacts | Truthy | Falsy,
354
354
StringFacts = BaseStringFacts | Truthy,
355
355
EmptyStringStrictFacts = BaseStringStrictFacts | Falsy,
@@ -1618,7 +1618,7 @@ namespace ts {
1618
1618
}
1619
1619
}
1620
1620
1621
- // May be an untyped module. If so, ignore resolutionDiagnostic.
1621
+ // May be an untyped module. If so, ignore resolutionDiagnostic.
1622
1622
if (!isRelative && resolvedModule && !extensionIsTypeScript(resolvedModule.extension)) {
1623
1623
if (isForAugmentation) {
1624
1624
const diag = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
@@ -3973,7 +3973,7 @@ namespace ts {
3973
3973
type;
3974
3974
}
3975
3975
3976
- function getTypeForDeclarationFromJSDocComment(declaration: Node ) {
3976
+ function getTypeForDeclarationFromJSDocComment(declaration: Node) {
3977
3977
const jsdocType = getJSDocType(declaration);
3978
3978
if (jsdocType) {
3979
3979
return getTypeFromTypeNode(jsdocType);
@@ -5640,7 +5640,7 @@ namespace ts {
5640
5640
function getConstraintOfType(type: TypeVariable | UnionOrIntersectionType): Type {
5641
5641
return type.flags & TypeFlags.TypeParameter ? getConstraintOfTypeParameter(<TypeParameter>type) :
5642
5642
type.flags & TypeFlags.IndexedAccess ? getConstraintOfIndexedAccess(<IndexedAccessType>type) :
5643
- getBaseConstraintOfType(type);
5643
+ getBaseConstraintOfType(type);
5644
5644
}
5645
5645
5646
5646
function getConstraintOfTypeParameter(typeParameter: TypeParameter): Type {
@@ -5713,7 +5713,7 @@ namespace ts {
5713
5713
}
5714
5714
return t.flags & TypeFlags.Union && baseTypes.length === types.length ? getUnionType(baseTypes) :
5715
5715
t.flags & TypeFlags.Intersection && baseTypes.length ? getIntersectionType(baseTypes) :
5716
- undefined;
5716
+ undefined;
5717
5717
}
5718
5718
if (t.flags & TypeFlags.Index) {
5719
5719
return stringType;
@@ -5764,11 +5764,11 @@ namespace ts {
5764
5764
const t = type.flags & TypeFlags.TypeVariable ? getBaseConstraintOfType(type) || emptyObjectType : type;
5765
5765
return t.flags & TypeFlags.Intersection ? getApparentTypeOfIntersectionType(<IntersectionType>t) :
5766
5766
t.flags & TypeFlags.StringLike ? globalStringType :
5767
- t.flags & TypeFlags.NumberLike ? globalNumberType :
5768
- t.flags & TypeFlags.BooleanLike ? globalBooleanType :
5769
- t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) :
5770
- t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
5771
- t;
5767
+ t.flags & TypeFlags.NumberLike ? globalNumberType :
5768
+ t.flags & TypeFlags.BooleanLike ? globalBooleanType :
5769
+ t.flags & TypeFlags.ESSymbol ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= ScriptTarget.ES2015) :
5770
+ t.flags & TypeFlags.NonPrimitive ? emptyObjectType :
5771
+ t;
5772
5772
}
5773
5773
5774
5774
function createUnionOrIntersectionProperty(containingType: UnionOrIntersectionType, name: string): Symbol {
@@ -7212,8 +7212,8 @@ namespace ts {
7212
7212
function getIndexType(type: Type): Type {
7213
7213
return maybeTypeOfKind(type, TypeFlags.TypeVariable) ? getIndexTypeForGenericType(<TypeVariable | UnionOrIntersectionType>type) :
7214
7214
getObjectFlags(type) & ObjectFlags.Mapped ? getConstraintTypeFromMappedType(<MappedType>type) :
7215
- type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
7216
- getLiteralTypeFromPropertyNames(type);
7215
+ type.flags & TypeFlags.Any || getIndexInfoOfType(type, IndexKind.String) ? stringType :
7216
+ getLiteralTypeFromPropertyNames(type);
7217
7217
}
7218
7218
7219
7219
function getIndexTypeOrString(type: Type): Type {
@@ -7409,7 +7409,7 @@ namespace ts {
7409
7409
* this function should be called in a left folding style, with left = previous result of getSpreadType
7410
7410
* and right = the new element to be spread.
7411
7411
*/
7412
- function getSpreadType(left: Type, right: Type): Type {
7412
+ function getSpreadType(left: Type, right: Type): Type {
7413
7413
if (left.flags & TypeFlags.Any || right.flags & TypeFlags.Any) {
7414
7414
return anyType;
7415
7415
}
@@ -7698,7 +7698,7 @@ namespace ts {
7698
7698
function createTypeMapper(sources: Type[], targets: Type[]): TypeMapper {
7699
7699
const mapper: TypeMapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) :
7700
7700
sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) :
7701
- makeArrayTypeMapper(sources, targets);
7701
+ makeArrayTypeMapper(sources, targets);
7702
7702
mapper.mappedTypes = sources;
7703
7703
return mapper;
7704
7704
}
@@ -8502,7 +8502,7 @@ namespace ts {
8502
8502
(globalNumberType === source && numberType === target) ||
8503
8503
(globalBooleanType === source && booleanType === target) ||
8504
8504
(getGlobalESSymbolType(/*reportErrors*/ false) === source && esSymbolType === target)) {
8505
- reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
8505
+ reportError(Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
8506
8506
}
8507
8507
}
8508
8508
@@ -9631,25 +9631,25 @@ namespace ts {
9631
9631
function isLiteralType(type: Type): boolean {
9632
9632
return type.flags & TypeFlags.Boolean ? true :
9633
9633
type.flags & TypeFlags.Union ? type.flags & TypeFlags.Enum ? true : !forEach((<UnionType>type).types, t => !isUnitType(t)) :
9634
- isUnitType(type);
9634
+ isUnitType(type);
9635
9635
}
9636
9636
9637
9637
function getBaseTypeOfLiteralType(type: Type): Type {
9638
9638
return type.flags & TypeFlags.StringLiteral ? stringType :
9639
9639
type.flags & TypeFlags.NumberLiteral ? numberType :
9640
- type.flags & TypeFlags.BooleanLiteral ? booleanType :
9641
- type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
9642
- type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getBaseTypeOfLiteralType)) :
9643
- type;
9640
+ type.flags & TypeFlags.BooleanLiteral ? booleanType :
9641
+ type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
9642
+ type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getBaseTypeOfLiteralType)) :
9643
+ type;
9644
9644
}
9645
9645
9646
9646
function getWidenedLiteralType(type: Type): Type {
9647
9647
return type.flags & TypeFlags.StringLiteral && type.flags & TypeFlags.FreshLiteral ? stringType :
9648
9648
type.flags & TypeFlags.NumberLiteral && type.flags & TypeFlags.FreshLiteral ? numberType :
9649
- type.flags & TypeFlags.BooleanLiteral ? booleanType :
9650
- type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
9651
- type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getWidenedLiteralType)) :
9652
- type;
9649
+ type.flags & TypeFlags.BooleanLiteral ? booleanType :
9650
+ type.flags & TypeFlags.EnumLiteral ? (<EnumLiteralType>type).baseType :
9651
+ type.flags & TypeFlags.Union && !(type.flags & TypeFlags.Enum) ? getUnionType(sameMap((<UnionType>type).types, getWidenedLiteralType)) :
9652
+ type;
9653
9653
}
9654
9654
9655
9655
/**
@@ -9674,9 +9674,9 @@ namespace ts {
9674
9674
function getFalsyFlags(type: Type): TypeFlags {
9675
9675
return type.flags & TypeFlags.Union ? getFalsyFlagsOfTypes((<UnionType>type).types) :
9676
9676
type.flags & TypeFlags.StringLiteral ? (<LiteralType>type).text === "" ? TypeFlags.StringLiteral : 0 :
9677
- type.flags & TypeFlags.NumberLiteral ? (<LiteralType>type).text === "0" ? TypeFlags.NumberLiteral : 0 :
9678
- type.flags & TypeFlags.BooleanLiteral ? type === falseType ? TypeFlags.BooleanLiteral : 0 :
9679
- type.flags & TypeFlags.PossiblyFalsy;
9677
+ type.flags & TypeFlags.NumberLiteral ? (<LiteralType>type).text === "0" ? TypeFlags.NumberLiteral : 0 :
9678
+ type.flags & TypeFlags.BooleanLiteral ? type === falseType ? TypeFlags.BooleanLiteral : 0 :
9679
+ type.flags & TypeFlags.PossiblyFalsy;
9680
9680
}
9681
9681
9682
9682
function includeFalsyTypes(type: Type, flags: TypeFlags) {
@@ -10862,8 +10862,8 @@ namespace ts {
10862
10862
isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, TypeFlags.NumberLiteral)) {
10863
10863
return mapType(typeWithPrimitives, t =>
10864
10864
t.flags & TypeFlags.String ? extractTypesOfKind(typeWithLiterals, TypeFlags.String | TypeFlags.StringLiteral) :
10865
- t.flags & TypeFlags.Number ? extractTypesOfKind(typeWithLiterals, TypeFlags.Number | TypeFlags.NumberLiteral) :
10866
- t);
10865
+ t.flags & TypeFlags.Number ? extractTypesOfKind(typeWithLiterals, TypeFlags.Number | TypeFlags.NumberLiteral) :
10866
+ t);
10867
10867
}
10868
10868
return typeWithPrimitives;
10869
10869
}
@@ -11439,7 +11439,7 @@ namespace ts {
11439
11439
const discriminantType = getUnionType(clauseTypes);
11440
11440
const caseType =
11441
11441
discriminantType.flags & TypeFlags.Never ? neverType :
11442
- replacePrimitivesWithLiterals(filterType(type, t => isTypeComparableTo(discriminantType, t)), discriminantType);
11442
+ replacePrimitivesWithLiterals(filterType(type, t => isTypeComparableTo(discriminantType, t)), discriminantType);
11443
11443
if (!hasDefaultClause) {
11444
11444
return caseType;
11445
11445
}
@@ -11519,8 +11519,8 @@ namespace ts {
11519
11519
// two types.
11520
11520
return isTypeSubtypeOf(candidate, type) ? candidate :
11521
11521
isTypeAssignableTo(type, candidate) ? type :
11522
- isTypeAssignableTo(candidate, type) ? candidate :
11523
- getIntersectionType([type, candidate]);
11522
+ isTypeAssignableTo(candidate, type) ? candidate :
11523
+ getIntersectionType([type, candidate]);
11524
11524
}
11525
11525
11526
11526
function narrowTypeByTypePredicate(type: Type, callExpression: CallExpression, assumeTrue: boolean): Type {
@@ -11797,7 +11797,7 @@ namespace ts {
11797
11797
isInAmbientContext(declaration);
11798
11798
const initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, getRootDeclaration(declaration) as VariableLikeDeclaration) : type) :
11799
11799
type === autoType || type === autoArrayType ? undefinedType :
11800
- includeFalsyTypes(type, TypeFlags.Undefined);
11800
+ includeFalsyTypes(type, TypeFlags.Undefined);
11801
11801
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer, !assumeInitialized);
11802
11802
// A variable is considered uninitialized when it is possible to analyze the entire control flow graph
11803
11803
// from declaration to use, and when the variable's declared type doesn't include undefined but the
@@ -12304,7 +12304,7 @@ namespace ts {
12304
12304
func.kind === SyntaxKind.GetAccessor ||
12305
12305
func.kind === SyntaxKind.SetAccessor) && func.parent.kind === SyntaxKind.ObjectLiteralExpression ? <ObjectLiteralExpression>func.parent :
12306
12306
func.kind === SyntaxKind.FunctionExpression && func.parent.kind === SyntaxKind.PropertyAssignment ? <ObjectLiteralExpression>func.parent.parent :
12307
- undefined;
12307
+ undefined;
12308
12308
}
12309
12309
12310
12310
function getThisTypeArgument(type: Type): Type {
0 commit comments