@putout/printer 2.73.0 → 2.74.0
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.
package/ChangeLog
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const isParens = (path) => path.node.extra?.parenthesized;
|
|
4
4
|
|
|
5
5
|
module.exports.ConditionalExpression = {
|
|
6
|
-
|
|
6
|
+
condition: isParens,
|
|
7
7
|
before(path, {print}) {
|
|
8
8
|
print('(');
|
|
9
9
|
},
|
|
@@ -18,7 +18,6 @@ module.exports.ConditionalExpression = {
|
|
|
18
18
|
print.space();
|
|
19
19
|
print('__alternate');
|
|
20
20
|
},
|
|
21
|
-
afterSatisfy: () => [isParens],
|
|
22
21
|
after(path, {print}) {
|
|
23
22
|
print(')');
|
|
24
23
|
},
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {markAfter} = require('../../mark');
|
|
4
|
-
|
|
5
4
|
const {isNext, isNextParent} = require('../../is');
|
|
6
|
-
|
|
7
5
|
const {printParams} = require('./params');
|
|
8
6
|
|
|
9
7
|
module.exports.FunctionDeclaration = {
|
|
10
8
|
print(path, printer, semantics) {
|
|
11
9
|
const {print, maybe} = printer;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const {
|
|
11
|
+
async,
|
|
12
|
+
generator,
|
|
13
|
+
returnType,
|
|
14
|
+
} = path.node;
|
|
14
15
|
|
|
15
16
|
maybe.print(async, 'async ');
|
|
16
17
|
|
|
@@ -22,8 +23,12 @@ module.exports.FunctionDeclaration = {
|
|
|
22
23
|
|
|
23
24
|
printParams(path, printer, semantics);
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
if (returnType) {
|
|
27
|
+
print(': ');
|
|
28
|
+
print('__returnType');
|
|
29
|
+
}
|
|
26
30
|
|
|
31
|
+
print.space();
|
|
27
32
|
print('__body');
|
|
28
33
|
},
|
|
29
34
|
afterSatisfy: () => [isNext, isNextParent],
|
|
@@ -176,20 +176,14 @@ module.exports = {
|
|
|
176
176
|
|
|
177
177
|
print('__typeAnnotation');
|
|
178
178
|
},
|
|
179
|
-
TSConstructSignatureDeclaration(path,
|
|
180
|
-
write
|
|
181
|
-
write('(');
|
|
182
|
-
|
|
183
|
-
const params = path.get('parameters');
|
|
184
|
-
const n = params.length - 1;
|
|
179
|
+
TSConstructSignatureDeclaration(path, printer, semantics) {
|
|
180
|
+
const {write, traverse} = printer;
|
|
185
181
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
182
|
+
write('new');
|
|
183
|
+
printParams(path, printer, semantics, {
|
|
184
|
+
params: path.get('parameters'),
|
|
185
|
+
});
|
|
191
186
|
|
|
192
|
-
write(')');
|
|
193
187
|
const typeAnnotation = path.get('typeAnnotation');
|
|
194
188
|
|
|
195
189
|
if (exists(typeAnnotation)) {
|
|
@@ -214,20 +208,13 @@ module.exports = {
|
|
|
214
208
|
print.space();
|
|
215
209
|
print('__typeAnnotation');
|
|
216
210
|
},
|
|
217
|
-
TSMethodSignature(path,
|
|
218
|
-
traverse
|
|
219
|
-
write('(');
|
|
220
|
-
|
|
221
|
-
const params = path.get('parameters');
|
|
222
|
-
const n = params.length - 1;
|
|
211
|
+
TSMethodSignature(path, printer, semantics) {
|
|
212
|
+
const {traverse, write} = printer;
|
|
223
213
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
write(')');
|
|
214
|
+
traverse(path.get('key'));
|
|
215
|
+
printParams(path, printer, semantics, {
|
|
216
|
+
params: path.get('parameters'),
|
|
217
|
+
});
|
|
231
218
|
|
|
232
219
|
const typeAnnotation = path.get('typeAnnotation');
|
|
233
220
|
|
|
@@ -243,4 +230,9 @@ module.exports = {
|
|
|
243
230
|
},
|
|
244
231
|
TSPropertySignature,
|
|
245
232
|
TSFunctionType,
|
|
233
|
+
TSTypePredicate(path, {print}) {
|
|
234
|
+
print('__parameterName');
|
|
235
|
+
print(' is ');
|
|
236
|
+
print('__typeAnnotation');
|
|
237
|
+
},
|
|
246
238
|
};
|
package/package.json
CHANGED