Skip to content

Commit

Permalink
[NTI] Don't warn about the use of 'symbol' in typeof.
Browse files Browse the repository at this point in the history
Fixes #2320 on github.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=149059410
  • Loading branch information
dimvar authored and brad4d committed Mar 3, 2017
1 parent e84876c commit 0e94c8a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/com/google/javascript/jscomp/NewTypeInference.java
Original file line number Diff line number Diff line change
Expand Up @@ -2457,6 +2457,7 @@ private void checkInvalidTypename(Node typeString) {
case "undefined":
case "function":
case "object":
case "symbol":
case "unknown": // IE-specific type name
break;
default:
Expand Down
8 changes: 8 additions & 0 deletions test/com/google/javascript/jscomp/NewTypeInferenceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2912,6 +2912,14 @@ public void testTypeof() {
" } else if (typeof x.prop.prop2 === 'number') {",
" }",
"}"));

typeCheck(LINE_JOINER.join(
"function f(x) {",
" if (typeof x === 'symbol') {",
// We don't know what symbols are yet.
" var /** null */ n = x;",
" }",
"}"));
}

public void testAssignWithOp() {
Expand Down

0 comments on commit 0e94c8a

Please sign in to comment.