@@ -368,7 +368,7 @@ namespace ts {
368
368
return emitResolver;
369
369
}
370
370
371
- function error(location: Node, message: DiagnosticMessage, arg0?: any , arg1?: any , arg2?: any ): void {
371
+ function error(location: Node, message: DiagnosticMessage, arg0?: string | number , arg1?: string | number , arg2?: string | number ): void {
372
372
const diagnostic = location
373
373
? createDiagnosticForNode(location, message, arg0, arg1, arg2)
374
374
: createCompilerDiagnostic(message, arg0, arg1, arg2);
@@ -1054,7 +1054,7 @@ namespace ts {
1054
1054
if (node.moduleReference.kind === SyntaxKind.ExternalModuleReference) {
1055
1055
return resolveExternalModuleSymbol(resolveExternalModuleName(node, getExternalModuleImportEqualsDeclarationExpression(node)));
1056
1056
}
1057
- return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>node.moduleReference, node );
1057
+ return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>node.moduleReference);
1058
1058
}
1059
1059
1060
1060
function getTargetOfImportClause(node: ImportClause): Symbol {
@@ -1267,7 +1267,7 @@ namespace ts {
1267
1267
}
1268
1268
1269
1269
// This function is only for imports with entity names
1270
- function getSymbolOfPartOfRightHandSideOfImportEquals(entityName: EntityName, importDeclaration: ImportEqualsDeclaration, dontResolveAlias?: boolean): Symbol {
1270
+ function getSymbolOfPartOfRightHandSideOfImportEquals(entityName: EntityName, dontResolveAlias?: boolean): Symbol {
1271
1271
// There are three things we might try to look for. In the following examples,
1272
1272
// the search term is enclosed in |...|:
1273
1273
//
@@ -2589,7 +2589,7 @@ namespace ts {
2589
2589
}
2590
2590
}
2591
2591
2592
- function buildDisplayForTypeArgumentsAndDelimiters(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node, flags?: TypeFormatFlags, symbolStack?: Symbol[] ) {
2592
+ function buildDisplayForTypeArgumentsAndDelimiters(typeParameters: TypeParameter[], mapper: TypeMapper, writer: SymbolWriter, enclosingDeclaration?: Node) {
2593
2593
if (typeParameters && typeParameters.length) {
2594
2594
writePunctuation(writer, SyntaxKind.LessThanToken);
2595
2595
let flags = TypeFormatFlags.InFirstTypeArgument;
@@ -4801,7 +4801,7 @@ namespace ts {
4801
4801
const typeParameters = classType ? classType.localTypeParameters :
4802
4802
declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
4803
4803
getTypeParametersFromJSDocTemplate(declaration);
4804
- const returnType = getSignatureReturnTypeFromDeclaration(declaration, minArgumentCount, isJSConstructSignature, classType);
4804
+ const returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
4805
4805
const typePredicate = declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ?
4806
4806
createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
4807
4807
undefined;
@@ -4811,7 +4811,7 @@ namespace ts {
4811
4811
return links.resolvedSignature;
4812
4812
}
4813
4813
4814
- function getSignatureReturnTypeFromDeclaration(declaration: SignatureDeclaration, minArgumentCount: number, isJSConstructSignature: boolean, classType: Type) {
4814
+ function getSignatureReturnTypeFromDeclaration(declaration: SignatureDeclaration, isJSConstructSignature: boolean, classType: Type) {
4815
4815
if (isJSConstructSignature) {
4816
4816
return getTypeFromTypeNode(declaration.parameters[0].type);
4817
4817
}
@@ -5176,10 +5176,7 @@ namespace ts {
5176
5176
return undefined;
5177
5177
}
5178
5178
5179
- function resolveTypeReferenceName(
5180
- node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference,
5181
- typeReferenceName: EntityNameExpression | EntityName) {
5182
-
5179
+ function resolveTypeReferenceName(typeReferenceName: EntityNameExpression | EntityName) {
5183
5180
if (!typeReferenceName) {
5184
5181
return unknownSymbol;
5185
5182
}
@@ -5217,7 +5214,7 @@ namespace ts {
5217
5214
let type: Type;
5218
5215
if (node.kind === SyntaxKind.JSDocTypeReference) {
5219
5216
const typeReferenceName = getTypeReferenceName(node);
5220
- symbol = resolveTypeReferenceName(node, typeReferenceName);
5217
+ symbol = resolveTypeReferenceName(typeReferenceName);
5221
5218
type = getTypeReferenceType(node, symbol);
5222
5219
}
5223
5220
else {
@@ -6679,8 +6676,8 @@ namespace ts {
6679
6676
}
6680
6677
if (source.flags & TypeFlags.Union && target.flags & TypeFlags.Union ||
6681
6678
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
6682
- if (result = eachTypeRelatedToSomeType(<UnionOrIntersectionType>source, <UnionOrIntersectionType>target, /*reportErrors*/ false )) {
6683
- if (result &= eachTypeRelatedToSomeType(<UnionOrIntersectionType>target, <UnionOrIntersectionType>source, /*reportErrors*/ false )) {
6679
+ if (result = eachTypeRelatedToSomeType(<UnionOrIntersectionType>source, <UnionOrIntersectionType>target)) {
6680
+ if (result &= eachTypeRelatedToSomeType(<UnionOrIntersectionType>target, <UnionOrIntersectionType>source)) {
6684
6681
return result;
6685
6682
}
6686
6683
}
@@ -6741,7 +6738,7 @@ namespace ts {
6741
6738
return false;
6742
6739
}
6743
6740
6744
- function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType, reportErrors: boolean ): Ternary {
6741
+ function eachTypeRelatedToSomeType(source: UnionOrIntersectionType, target: UnionOrIntersectionType): Ternary {
6745
6742
let result = Ternary.True;
6746
6743
const sourceTypes = source.types;
6747
6744
for (const sourceType of sourceTypes) {
@@ -11778,7 +11775,7 @@ namespace ts {
11778
11775
// If the effective argument is 'undefined', then it is an argument that is present but is synthetic.
11779
11776
if (arg === undefined || arg.kind !== SyntaxKind.OmittedExpression) {
11780
11777
const paramType = getTypeAtPosition(signature, i);
11781
- let argType = getEffectiveArgumentType(node, i, arg );
11778
+ let argType = getEffectiveArgumentType(node, i);
11782
11779
11783
11780
// If the effective argument type is 'undefined', there is no synthetic type
11784
11781
// for the argument. In that case, we should check the argument.
@@ -11864,7 +11861,7 @@ namespace ts {
11864
11861
if (arg === undefined || arg.kind !== SyntaxKind.OmittedExpression) {
11865
11862
// Check spread elements against rest type (from arity check we know spread argument corresponds to a rest parameter)
11866
11863
const paramType = getTypeAtPosition(signature, i);
11867
- let argType = getEffectiveArgumentType(node, i, arg );
11864
+ let argType = getEffectiveArgumentType(node, i);
11868
11865
11869
11866
// If the effective argument type is 'undefined', there is no synthetic type
11870
11867
// for the argument. In that case, we should check the argument.
@@ -12157,7 +12154,7 @@ namespace ts {
12157
12154
/**
12158
12155
* Gets the effective argument type for an argument in a call expression.
12159
12156
*/
12160
- function getEffectiveArgumentType(node: CallLikeExpression, argIndex: number, arg: Expression ): Type {
12157
+ function getEffectiveArgumentType(node: CallLikeExpression, argIndex: number): Type {
12161
12158
// Decorators provide special arguments, a tagged template expression provides
12162
12159
// a special first argument, and string literals get string literal types
12163
12160
// unless we're reporting errors
@@ -13562,15 +13559,15 @@ namespace ts {
13562
13559
return booleanType;
13563
13560
}
13564
13561
13565
- function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper ): Type {
13562
+ function checkObjectLiteralAssignment(node: ObjectLiteralExpression, sourceType: Type): Type {
13566
13563
const properties = node.properties;
13567
13564
for (const p of properties) {
13568
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, contextualMapper );
13565
+ checkObjectLiteralDestructuringPropertyAssignment(sourceType, p);
13569
13566
}
13570
13567
return sourceType;
13571
13568
}
13572
13569
13573
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElementLike, contextualMapper?: TypeMapper ) {
13570
+ function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType: Type, property: ObjectLiteralElementLike) {
13574
13571
if (property.kind === SyntaxKind.PropertyAssignment || property.kind === SyntaxKind.ShorthandPropertyAssignment) {
13575
13572
const name = <PropertyName>(<PropertyAssignment>property).name;
13576
13573
if (name.kind === SyntaxKind.ComputedPropertyName) {
@@ -13685,7 +13682,7 @@ namespace ts {
13685
13682
target = (<BinaryExpression>target).left;
13686
13683
}
13687
13684
if (target.kind === SyntaxKind.ObjectLiteralExpression) {
13688
- return checkObjectLiteralAssignment(<ObjectLiteralExpression>target, sourceType, contextualMapper );
13685
+ return checkObjectLiteralAssignment(<ObjectLiteralExpression>target, sourceType);
13689
13686
}
13690
13687
if (target.kind === SyntaxKind.ArrayLiteralExpression) {
13691
13688
return checkArrayLiteralAssignment(<ArrayLiteralExpression>target, sourceType, contextualMapper);
@@ -18594,7 +18591,7 @@ namespace ts {
18594
18591
// Since we already checked for ExportAssignment, this really could only be an Import
18595
18592
const importEqualsDeclaration = <ImportEqualsDeclaration>getAncestor(entityName, SyntaxKind.ImportEqualsDeclaration);
18596
18593
Debug.assert(importEqualsDeclaration !== undefined);
18597
- return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>entityName, importEqualsDeclaration, /*dontResolveAlias*/ true);
18594
+ return getSymbolOfPartOfRightHandSideOfImportEquals(<EntityName>entityName, /*dontResolveAlias*/ true);
18598
18595
}
18599
18596
18600
18597
if (isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
@@ -19977,7 +19974,7 @@ namespace ts {
19977
19974
}
19978
19975
}
19979
19976
19980
- function checkGrammarTypeParameterList(node: FunctionLikeDeclaration, typeParameters: NodeArray<TypeParameterDeclaration>, file: SourceFile): boolean {
19977
+ function checkGrammarTypeParameterList(typeParameters: NodeArray<TypeParameterDeclaration>, file: SourceFile): boolean {
19981
19978
if (checkGrammarForDisallowedTrailingComma(typeParameters)) {
19982
19979
return true;
19983
19980
}
@@ -20028,7 +20025,7 @@ namespace ts {
20028
20025
function checkGrammarFunctionLikeDeclaration(node: FunctionLikeDeclaration): boolean {
20029
20026
// Prevent cascading error by short-circuit
20030
20027
const file = getSourceFileOfNode(node);
20031
- return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node, node .typeParameters, file) ||
20028
+ return checkGrammarDecorators(node) || checkGrammarModifiers(node) || checkGrammarTypeParameterList(node.typeParameters, file) ||
20032
20029
checkGrammarParameterList(node.parameters) || checkGrammarArrowFunction(node, file);
20033
20030
}
20034
20031
@@ -20214,7 +20211,7 @@ namespace ts {
20214
20211
}
20215
20212
}
20216
20213
20217
- function checkGrammarForInvalidQuestionMark(node: Declaration, questionToken: Node, message: DiagnosticMessage): boolean {
20214
+ function checkGrammarForInvalidQuestionMark(questionToken: Node, message: DiagnosticMessage): boolean {
20218
20215
if (questionToken) {
20219
20216
return grammarErrorOnNode(questionToken, message);
20220
20217
}
@@ -20260,7 +20257,7 @@ namespace ts {
20260
20257
let currentKind: number;
20261
20258
if (prop.kind === SyntaxKind.PropertyAssignment || prop.kind === SyntaxKind.ShorthandPropertyAssignment) {
20262
20259
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
20263
- checkGrammarForInvalidQuestionMark(prop, (<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
20260
+ checkGrammarForInvalidQuestionMark((<PropertyAssignment>prop).questionToken, Diagnostics.An_object_member_cannot_be_declared_optional);
20264
20261
if (name.kind === SyntaxKind.NumericLiteral) {
20265
20262
checkGrammarNumericLiteral(<NumericLiteral>name);
20266
20263
}
@@ -20444,7 +20441,7 @@ namespace ts {
20444
20441
}
20445
20442
20446
20443
if (node.parent.kind === SyntaxKind.ObjectLiteralExpression) {
20447
- if (checkGrammarForInvalidQuestionMark(node, node .questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) {
20444
+ if (checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) {
20448
20445
return true;
20449
20446
}
20450
20447
else if (node.body === undefined) {
0 commit comments