@putout/printer 2.69.0 → 2.71.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
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
2023.07.14, v2.71.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 71bf28d @putout/printer: TSTypeParameterInstantiation: couple params (coderaiser/putout#147)
|
|
5
|
+
|
|
6
|
+
2023.07.12, v2.70.0
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- a20823b @putout/printer: ExportDeclaration: add support of exportKind
|
|
10
|
+
|
|
1
11
|
2023.07.10, v2.69.0
|
|
2
12
|
|
|
3
13
|
feature:
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
const {parseComments} = require('../../comment/comment');
|
|
4
4
|
|
|
5
5
|
module.exports.printParams = (path, printer, semantics, customization = {}) => {
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
params = path.get('params'),
|
|
8
|
+
braceOpen = '(',
|
|
9
|
+
braceClose = ')',
|
|
10
|
+
} = customization;
|
|
7
11
|
|
|
8
12
|
const {print, traverse} = printer;
|
|
9
13
|
|
|
10
14
|
printBraceOpen(path, {
|
|
11
15
|
print,
|
|
16
|
+
braceOpen,
|
|
12
17
|
});
|
|
13
18
|
|
|
14
19
|
parseComments(path, printer, semantics);
|
|
@@ -28,21 +33,22 @@ module.exports.printParams = (path, printer, semantics, customization = {}) => {
|
|
|
28
33
|
|
|
29
34
|
printBraceClose(path, {
|
|
30
35
|
print,
|
|
36
|
+
braceClose,
|
|
31
37
|
});
|
|
32
38
|
};
|
|
33
39
|
|
|
34
|
-
function printBraceOpen(path, {print}) {
|
|
40
|
+
function printBraceOpen(path, {print, braceOpen}) {
|
|
35
41
|
if (isOneArgArrow(path))
|
|
36
42
|
return print.roundBraceOpen();
|
|
37
43
|
|
|
38
|
-
return print(
|
|
44
|
+
return print(braceOpen);
|
|
39
45
|
}
|
|
40
46
|
|
|
41
|
-
function printBraceClose(path, {print}) {
|
|
47
|
+
function printBraceClose(path, {print, braceClose}) {
|
|
42
48
|
if (isOneArgArrow(path))
|
|
43
49
|
return print.roundBraceClose();
|
|
44
50
|
|
|
45
|
-
print(
|
|
51
|
+
print(braceClose);
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
function isOneArgArrow(path) {
|
|
@@ -75,7 +75,9 @@ module.exports.ExportNamedDeclaration = {
|
|
|
75
75
|
maybe.write.newline(isNewline);
|
|
76
76
|
|
|
77
77
|
for (const spec of specifiers) {
|
|
78
|
+
const isType = spec.node.exportKind === 'type';
|
|
78
79
|
maybe.indent(isNewline);
|
|
80
|
+
maybe.write(isType, 'type ');
|
|
79
81
|
traverse(spec);
|
|
80
82
|
maybe.write(isNewline, ',');
|
|
81
83
|
maybe.write.newline(isNewline);
|
|
@@ -19,6 +19,7 @@ const {TSInterfaceBody} = require('./interface/ts-interface-body');
|
|
|
19
19
|
const {TSIntersectionType} = require('./ts-intersection-type');
|
|
20
20
|
const {TSPropertySignature} = require('./ts-property-signature');
|
|
21
21
|
const {TSFunctionType} = require('./ts-function-type');
|
|
22
|
+
const {printParams} = require('../expressions/functions/params');
|
|
22
23
|
|
|
23
24
|
module.exports = {
|
|
24
25
|
TSAsExpression,
|
|
@@ -77,23 +78,17 @@ module.exports = {
|
|
|
77
78
|
print('...');
|
|
78
79
|
print('__typeAnnotation');
|
|
79
80
|
},
|
|
80
|
-
TSTypeParameterDeclaration(path,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
path
|
|
93
|
-
.get('params')
|
|
94
|
-
.forEach(print);
|
|
95
|
-
|
|
96
|
-
print('>');
|
|
81
|
+
TSTypeParameterDeclaration(path, printer, semantics) {
|
|
82
|
+
printParams(path, printer, semantics, {
|
|
83
|
+
braceOpen: '<',
|
|
84
|
+
braceClose: '>',
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
TSTypeParameterInstantiation(path, printer, semantics) {
|
|
88
|
+
printParams(path, printer, semantics, {
|
|
89
|
+
braceOpen: '<',
|
|
90
|
+
braceClose: '>',
|
|
91
|
+
});
|
|
97
92
|
},
|
|
98
93
|
TSTypeReference(path, {print}) {
|
|
99
94
|
print('__typeName');
|
package/package.json
CHANGED