@putout/printer 1.96.0 → 1.97.1

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.05.11, v1.97.1
2
+
3
+ feature:
4
+ - 746b611 @putout/printer: TSInterfaceDeclaration: newline
5
+
6
+ 2023.05.11, v1.97.0
7
+
8
+ feature:
9
+ - b0aa0ff @putout/printer: TSAsExpression inside MemberExpression: improve support
10
+
1
11
  2023.05.11, v1.96.0
2
12
 
3
13
  feature:
@@ -45,6 +45,7 @@ module.exports.OptionalMemberExpression = (path, {print, maybe}) => {
45
45
  computed,
46
46
  optional,
47
47
  } = path.node;
48
+
48
49
  print('__object');
49
50
  maybe.print(optional, '?');
50
51
  print('.');
@@ -14,8 +14,10 @@ const {
14
14
  } = require('./ts-module-declaration');
15
15
 
16
16
  const {TSInterfaceDeclaration} = require('./ts-interface-declaration');
17
+ const {TSAsExpression} = require('./ts-as-expression');
17
18
 
18
19
  module.exports = {
20
+ TSAsExpression,
19
21
  TSTypeLiteral,
20
22
  TSTypeAliasDeclaration,
21
23
  TSTypeParameter,
@@ -108,11 +110,6 @@ module.exports = {
108
110
  print('>');
109
111
  print('__expression');
110
112
  },
111
- TSAsExpression(path, {print}) {
112
- print('__expression');
113
- print(' as ');
114
- print('__typeAnnotation');
115
- },
116
113
  TSParenthesizedType(path, {print}) {
117
114
  print('(');
118
115
  print('__typeAnnotation');
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ module.exports.TSAsExpression = {
4
+ condition(path) {
5
+ return path.parentPath.isMemberExpression();
6
+ },
7
+ before(path, {write}) {
8
+ write('(');
9
+ },
10
+ print(path, {print}) {
11
+ print('__expression');
12
+ print(' as ');
13
+ print('__typeAnnotation');
14
+ },
15
+ after(path, {write}) {
16
+ write(')');
17
+ },
18
+ };
@@ -1,10 +1,18 @@
1
1
  'use strict';
2
2
 
3
- module.exports.TSInterfaceDeclaration = (path, {print}) => {
4
- print('interface ');
5
- print('__id');
6
- print('__body');
7
-
8
- print.breakline();
9
- print.breakline();
3
+ const {isNext} = require('../is');
4
+ module.exports.TSInterfaceDeclaration = {
5
+ print(path, {print}) {
6
+ print('interface ');
7
+ print('__id');
8
+ print('__body');
9
+ },
10
+ afterSatisfy: () => [
11
+ isNext,
12
+ ],
13
+ after(path, {print}) {
14
+ print.breakline();
15
+ print.breakline();
16
+ },
10
17
  };
18
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.96.0",
3
+ "version": "1.97.1",
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",