@putout/printer 2.47.0 → 2.48.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 +5 -0
- package/lib/tokenize/statements/program.js +1 -1
- package/lib/tokenize/typescript/index.js +3 -16
- package/lib/tokenize/typescript/interface/ts-interface-body.js +19 -0
- package/lib/tokenize/typescript/{ts-interface-declaration.js → interface/ts-interface-declaration.js} +2 -1
- package/package.json +1 -1
package/ChangeLog
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {parseComments} = require('../comments/comments');
|
|
4
|
+
|
|
4
5
|
module.exports.Program = (path, {print, write}, semantics) => {
|
|
5
6
|
print('__interpreter');
|
|
6
7
|
parseComments(path, {write}, semantics);
|
|
@@ -11,4 +12,3 @@ module.exports.Program = (path, {print, write}, semantics) => {
|
|
|
11
12
|
|
|
12
13
|
print.newline();
|
|
13
14
|
};
|
|
14
|
-
|
|
@@ -13,8 +13,9 @@ const {
|
|
|
13
13
|
TSModuleBlock,
|
|
14
14
|
} = require('./ts-module-declaration');
|
|
15
15
|
|
|
16
|
-
const {TSInterfaceDeclaration} = require('./ts-interface-declaration');
|
|
16
|
+
const {TSInterfaceDeclaration} = require('./interface/ts-interface-declaration');
|
|
17
17
|
const {TSAsExpression} = require('./ts-as-expression');
|
|
18
|
+
const {TSInterfaceBody} = require('./interface/ts-interface-body');
|
|
18
19
|
|
|
19
20
|
module.exports = {
|
|
20
21
|
TSAsExpression,
|
|
@@ -104,21 +105,7 @@ module.exports = {
|
|
|
104
105
|
print('__typeAnnotation');
|
|
105
106
|
},
|
|
106
107
|
TSInterfaceDeclaration,
|
|
107
|
-
TSInterfaceBody
|
|
108
|
-
write(' {');
|
|
109
|
-
write.newline();
|
|
110
|
-
indent.inc();
|
|
111
|
-
|
|
112
|
-
for (const item of path.get('body')) {
|
|
113
|
-
indent();
|
|
114
|
-
traverse(item);
|
|
115
|
-
write(';');
|
|
116
|
-
write.newline();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
indent.dec();
|
|
120
|
-
write('}');
|
|
121
|
-
},
|
|
108
|
+
TSInterfaceBody,
|
|
122
109
|
TSTypeAssertion(path, {print}) {
|
|
123
110
|
print('<');
|
|
124
111
|
print('__typeAnnotation');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.TSInterfaceBody = (path, {traverse, write, indent, maybe}) => {
|
|
4
|
+
const body = path.get('body');
|
|
5
|
+
write.space();
|
|
6
|
+
write('{');
|
|
7
|
+
maybe.write.newline(body.length);
|
|
8
|
+
indent.inc();
|
|
9
|
+
|
|
10
|
+
for (const item of body) {
|
|
11
|
+
indent();
|
|
12
|
+
traverse(item);
|
|
13
|
+
write(';');
|
|
14
|
+
write.newline();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
indent.dec();
|
|
18
|
+
write('}');
|
|
19
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {isNext} = require('
|
|
3
|
+
const {isNext} = require('../../is');
|
|
4
4
|
|
|
5
5
|
module.exports.TSInterfaceDeclaration = {
|
|
6
6
|
print(path, {print}) {
|
|
@@ -14,3 +14,4 @@ module.exports.TSInterfaceDeclaration = {
|
|
|
14
14
|
print.breakline();
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
package/package.json
CHANGED