We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents acc8018 + 5c58b52 commit 436ba9bCopy full SHA for 436ba9b
packages/babel/src/traversal/path/evaluation.js
@@ -119,13 +119,20 @@ export function evaluate(): { confident: boolean; value: any } {
119
}
120
121
if (path.isUnaryExpression({ prefix: true })) {
122
- var arg = evaluate(path.get("argument"));
+ var argument = path.get("argument");
123
+ var arg = evaluate(argument);
124
switch (node.operator) {
125
case "void": return undefined;
126
case "!": return !arg;
127
case "+": return +arg;
128
case "-": return -arg;
129
case "~": return ~arg;
130
+ case "typeof":
131
+ if (argument.isFunction()) {
132
+ return "function";
133
+ } else {
134
+ return typeof arg;
135
+ }
136
137
138
0 commit comments