@@ -1681,7 +1681,7 @@ module ts {
1681
1681
// Return the inferred type for a binding element
1682
1682
function getTypeForBindingElement(declaration: BindingElement): Type {
1683
1683
var pattern = <BindingPattern>declaration.parent;
1684
- var parentType = getTypeForVariableDeclaration (<VariableLikeDeclaration>pattern.parent);
1684
+ var parentType = getTypeForVariableLikeDeclaration (<VariableLikeDeclaration>pattern.parent);
1685
1685
// If parent has the unknown (error) type, then so does this binding element
1686
1686
if (parentType === unknownType) {
1687
1687
return unknownType;
@@ -1725,7 +1725,7 @@ module ts {
1725
1725
}
1726
1726
1727
1727
// Return the inferred type for a variable, parameter, or property declaration
1728
- function getTypeForVariableDeclaration (declaration: VariableLikeDeclaration): Type {
1728
+ function getTypeForVariableLikeDeclaration (declaration: VariableLikeDeclaration): Type {
1729
1729
// A variable declared in a for..in statement is always of type any
1730
1730
if (declaration.parent.kind === SyntaxKind.ForInStatement) {
1731
1731
return anyType;
@@ -1808,8 +1808,8 @@ module ts {
1808
1808
// Here, the array literal [1, "one"] is contextually typed by the type [any, string], which is the implied type of the
1809
1809
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
1810
1810
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
1811
- function getWidenedTypeForVariableDeclaration (declaration: VariableLikeDeclaration, reportErrors?: boolean): Type {
1812
- var type = getTypeForVariableDeclaration (declaration);
1811
+ function getWidenedTypeForVariableLikeDeclaration (declaration: VariableLikeDeclaration, reportErrors?: boolean): Type {
1812
+ var type = getTypeForVariableLikeDeclaration (declaration);
1813
1813
if (type) {
1814
1814
if (reportErrors) {
1815
1815
reportErrorsFromWidening(declaration, type);
@@ -1850,7 +1850,7 @@ module ts {
1850
1850
}
1851
1851
// Handle variable, parameter or property
1852
1852
links.type = resolvingType;
1853
- var type = getWidenedTypeForVariableDeclaration (<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
1853
+ var type = getWidenedTypeForVariableLikeDeclaration (<VariableLikeDeclaration>declaration, /*reportErrors*/ true);
1854
1854
if (links.type === resolvingType) {
1855
1855
links.type = type;
1856
1856
}
@@ -6970,7 +6970,7 @@ module ts {
6970
6970
var seenStringIndexer = false;
6971
6971
for (var i = 0, len = indexSymbol.declarations.length; i < len; ++i) {
6972
6972
var declaration = <SignatureDeclaration>indexSymbol.declarations[i];
6973
- if (declaration.parameters.length == 1 && declaration.parameters[0].type) {
6973
+ if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
6974
6974
switch (declaration.parameters[0].type.kind) {
6975
6975
case SyntaxKind.StringKeyword:
6976
6976
if (!seenStringIndexer) {
@@ -7755,7 +7755,7 @@ module ts {
7755
7755
// For a binding pattern, validate the initializer and exit
7756
7756
if (isBindingPattern(node.name)) {
7757
7757
if (node.initializer) {
7758
- checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableDeclaration (node), node, /*headMessage*/ undefined);
7758
+ checkTypeAssignableTo(checkExpressionCached(node.initializer), getWidenedTypeForVariableLikeDeclaration (node), node, /*headMessage*/ undefined);
7759
7759
checkParameterInitializer(node);
7760
7760
}
7761
7761
return;
@@ -7772,7 +7772,7 @@ module ts {
7772
7772
else {
7773
7773
// Node is a secondary declaration, check that type is identical to primary declaration and check that
7774
7774
// initializer is consistent with type associated with the node
7775
- var declarationType = getWidenedTypeForVariableDeclaration (node);
7775
+ var declarationType = getWidenedTypeForVariableLikeDeclaration (node);
7776
7776
if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) {
7777
7777
error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(type), typeToString(declarationType));
7778
7778
}
0 commit comments