@putout/printer 15.23.1 → 15.25.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
+ 2025.10.30, v15.25.0
2
+
3
+ feature:
4
+ - 96e0b13 @putout/printer: TSOptionalType: add
5
+
6
+ 2025.10.29, v15.24.0
7
+
8
+ feature:
9
+ - 926c187 @putout/printer: TSTypeParameter: default
10
+
1
11
  2025.10.01, v15.23.1
2
12
 
3
13
  feature:
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const {types} = require('@putout/babel');
4
- const {wrongShorthand} = require('./wrong-shortand');
4
+ const {wrongShorthand} = require('./wrong-shorthand');
5
5
 
6
6
  const {
7
7
  isForOf,
@@ -40,6 +40,7 @@ const {TSParameterProperty} = require('./ts-parameter-property/ts-parameter-prop
40
40
  const {TSTypeQuery} = require('./ts-type-query/ts-type-query');
41
41
  const {TSParenthesizedType} = require('./ts-parenthesized-type/ts-parenthesized-type');
42
42
  const {TSTemplateLiteralType} = require('./ts-template-literal-type/ts-template-literal-type');
43
+ const {TSOptionalType} = require('./ts-optional-type/ts-optional-type');
43
44
 
44
45
  module.exports = {
45
46
  TSAsExpression,
@@ -57,6 +58,7 @@ module.exports = {
57
58
  TSUnionType,
58
59
  TSTypeQuery,
59
60
  TSTemplateLiteralType,
61
+ TSOptionalType,
60
62
  TSBigIntKeyword(path, {write}) {
61
63
  write('bigint');
62
64
  },
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports.TSOptionalType = (path, {print}) => {
4
+ print('__typeAnnotation');
5
+ print('?');
6
+ };
@@ -14,12 +14,10 @@ module.exports.TSTypeParameter = (path, {write, traverse}) => {
14
14
 
15
15
  write(path.node.name.name);
16
16
 
17
- if (!exists(constraint))
18
- return;
19
-
20
- write(' extends ');
21
-
22
- traverse(constraint);
17
+ if (exists(constraint)) {
18
+ write(' extends ');
19
+ traverse(constraint);
20
+ }
23
21
 
24
22
  const defaultPath = path.get('default');
25
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "15.23.1",
3
+ "version": "15.25.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",