@babel/traverse 7.9.5 → 7.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @babel/traverse might be problematic. Click here for more details.
@@ -50,9 +50,19 @@ function getTypeAnnotationBindingConstantViolations(binding, path, name) {
|
|
50
50
|
}
|
51
51
|
}
|
52
52
|
|
53
|
-
if (types.length) {
|
54
|
-
return
|
53
|
+
if (!types.length) {
|
54
|
+
return;
|
55
|
+
}
|
56
|
+
|
57
|
+
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
58
|
+
return t.createTSUnionType(types);
|
59
|
+
}
|
60
|
+
|
61
|
+
if (t.createFlowUnionType) {
|
62
|
+
return t.createFlowUnionType(types);
|
55
63
|
}
|
64
|
+
|
65
|
+
return t.createUnionTypeAnnotation(types);
|
56
66
|
}
|
57
67
|
|
58
68
|
function getConstantViolationsBefore(binding, path, functions) {
|
@@ -165,6 +175,20 @@ function getConditionalAnnotation(binding, path, name) {
|
|
165
175
|
}
|
166
176
|
|
167
177
|
if (types.length) {
|
178
|
+
if (t.isTSTypeAnnotation(types[0]) && t.createTSUnionType) {
|
179
|
+
return {
|
180
|
+
typeAnnotation: t.createTSUnionType(types),
|
181
|
+
ifStatement
|
182
|
+
};
|
183
|
+
}
|
184
|
+
|
185
|
+
if (t.createFlowUnionType) {
|
186
|
+
return {
|
187
|
+
typeAnnotation: t.createFlowUnionType(types),
|
188
|
+
ifStatement
|
189
|
+
};
|
190
|
+
}
|
191
|
+
|
168
192
|
return {
|
169
193
|
typeAnnotation: t.createUnionTypeAnnotation(types),
|
170
194
|
ifStatement
|
@@ -112,11 +112,31 @@ function BinaryExpression(node) {
|
|
112
112
|
}
|
113
113
|
|
114
114
|
function LogicalExpression() {
|
115
|
-
|
115
|
+
const argumentTypes = [this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()];
|
116
|
+
|
117
|
+
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
118
|
+
return t.createTSUnionType(argumentTypes);
|
119
|
+
}
|
120
|
+
|
121
|
+
if (t.createFlowUnionType) {
|
122
|
+
return t.createFlowUnionType(argumentTypes);
|
123
|
+
}
|
124
|
+
|
125
|
+
return t.createUnionTypeAnnotation(argumentTypes);
|
116
126
|
}
|
117
127
|
|
118
128
|
function ConditionalExpression() {
|
119
|
-
|
129
|
+
const argumentTypes = [this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()];
|
130
|
+
|
131
|
+
if (t.isTSTypeAnnotation(argumentTypes[0]) && t.createTSUnionType) {
|
132
|
+
return t.createTSUnionType(argumentTypes);
|
133
|
+
}
|
134
|
+
|
135
|
+
if (t.createFlowUnionType) {
|
136
|
+
return t.createFlowUnionType(argumentTypes);
|
137
|
+
}
|
138
|
+
|
139
|
+
return t.createUnionTypeAnnotation(argumentTypes);
|
120
140
|
}
|
121
141
|
|
122
142
|
function SequenceExpression() {
|
package/lib/scope/index.js
CHANGED
@@ -654,7 +654,7 @@ class Scope {
|
|
654
654
|
}
|
655
655
|
|
656
656
|
return true;
|
657
|
-
} else if (t.
|
657
|
+
} else if (t.isMethod(node)) {
|
658
658
|
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
|
659
659
|
if (node.kind === "get" || node.kind === "set") return false;
|
660
660
|
return true;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@babel/traverse",
|
3
|
-
"version": "7.9.
|
3
|
+
"version": "7.9.6",
|
4
4
|
"description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes",
|
5
5
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
6
6
|
"homepage": "https://babeljs.io/",
|
@@ -12,11 +12,11 @@
|
|
12
12
|
"main": "lib/index.js",
|
13
13
|
"dependencies": {
|
14
14
|
"@babel/code-frame": "^7.8.3",
|
15
|
-
"@babel/generator": "^7.9.
|
15
|
+
"@babel/generator": "^7.9.6",
|
16
16
|
"@babel/helper-function-name": "^7.9.5",
|
17
17
|
"@babel/helper-split-export-declaration": "^7.8.3",
|
18
|
-
"@babel/parser": "^7.9.
|
19
|
-
"@babel/types": "^7.9.
|
18
|
+
"@babel/parser": "^7.9.6",
|
19
|
+
"@babel/types": "^7.9.6",
|
20
20
|
"debug": "^4.1.0",
|
21
21
|
"globals": "^11.1.0",
|
22
22
|
"lodash": "^4.17.13"
|
@@ -24,5 +24,5 @@
|
|
24
24
|
"devDependencies": {
|
25
25
|
"@babel/helper-plugin-test-runner": "^7.8.3"
|
26
26
|
},
|
27
|
-
"gitHead": "
|
27
|
+
"gitHead": "9c2846bcacc75aa931ea9d556950c2113765d43d"
|
28
28
|
}
|