Skip to content

Commit ea81831

Browse files
More comments.
1 parent f933b58 commit ea81831

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,6 +4099,12 @@ module ts {
40994099
// This is motivated by ECMA-262 sections 9.3.1, 9.8.1, 11.1.5, and 11.2.1.
41004100
//
41014101
// Here, we test whether 'ToString(ToNumber(name))' is exactly equal to 'name'.
4102+
// The '+' prefix operator is equivalent here to applying the abstract ToNumber operation.
4103+
// Applying the 'toString()' method on a number gives us the abstract ToString operation on a number.
4104+
//
4105+
// Note that this accepts the values 'Infinity', '-Infinity', and 'NaN', and that this is intentional.
4106+
// This is desired behavior, because when indexing with them as numeric entities, you are indexing
4107+
// with the strings '"Infinity"', '"-Infinity"', and '"NaN"' respectively.
41024108
return (+name).toString() === name;
41034109
}
41044110

0 commit comments

Comments
 (0)