@putout/printer 2.37.0 → 2.39.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.06.22, v2.39.0
2
+
3
+ feature:
4
+ - 2cb0a67 @putout/printer: TSIndexSignature: add
5
+
6
+ 2023.06.22, v2.38.0
7
+
8
+ feature:
9
+ - 1a9915d @putout/printer: TSMethodSignature: add
10
+
1
11
  2023.06.22, v2.37.0
2
12
 
3
13
  feature:
@@ -220,6 +220,37 @@ module.exports = {
220
220
  traverse(typeAnnotation);
221
221
  }
222
222
  },
223
+ TSIndexSignature(path, {print}) {
224
+ print('[');
225
+ print('__parameters.0');
226
+ print(']');
227
+ print(':');
228
+ print.space();
229
+ print('__typeAnnotation');
230
+ },
231
+ TSMethodSignature(path, {traverse, write, maybe}) {
232
+ traverse(path.get('key'));
233
+ write('(');
234
+
235
+ const params = path.get('parameters');
236
+ const n = params.length - 1;
237
+
238
+ for (const [index, param] of params.entries()) {
239
+ traverse(param);
240
+ maybe.write(index < n, ',');
241
+ maybe.write.space(index < n);
242
+ }
243
+
244
+ write(')');
245
+
246
+ const typeAnnotation = path.get('typeAnnotation');
247
+
248
+ if (exists(typeAnnotation)) {
249
+ write(':');
250
+ write.space();
251
+ traverse(typeAnnotation);
252
+ }
253
+ },
223
254
  TSExpressionWithTypeArguments(path, {print}) {
224
255
  print('__expression');
225
256
  print('__typeParameters');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "2.37.0",
3
+ "version": "2.39.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",