datagrok-tools 4.14.32 → 4.14.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.14.32",
3
+ "version": "4.14.33",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {
@@ -347,26 +347,32 @@ class FuncGeneratorPlugin {
347
347
 
348
348
  _readReturnType(annotation) {
349
349
  let resultType = 'dynamic';
350
+ let nodeAnnotation = annotation;
350
351
  let isArray = false;
352
+ if (nodeAnnotation?.type === 'TSUnionType' &&
353
+ nodeAnnotation?.types?.length === 2 &&
354
+ nodeAnnotation?.types?.some((e)=> e?.type === 'TSNullKeyword'))
355
+ nodeAnnotation = nodeAnnotation.types.filter((e)=> e.type !== 'TSNullKeyword')[0];
356
+
357
+
351
358
  if (
352
- annotation &&
353
- annotation.type !== 'TSUnionType' &&
354
- annotation.type !== 'TSIntersectionType'
359
+ nodeAnnotation &&
360
+ nodeAnnotation.type !== 'TSUnionType' &&
361
+ nodeAnnotation.type !== 'TSIntersectionType'
355
362
  ) {
356
-
357
- if (annotation.typeName || annotation.type === 'TSTypeReference') {
363
+ if (nodeAnnotation.typeName || nodeAnnotation.type === 'TSTypeReference') {
358
364
  resultType =
359
- annotation.typeName?.right?.name ?? annotation.typeName?.name;
360
- } else if (annotation.type !== 'TSArrayType')
361
- resultType = this._getTypeNameFromNode(annotation);
362
- else if (annotation.elementType.type !== 'TSTypeReference') {
365
+ nodeAnnotation.typeName?.right?.name ?? nodeAnnotation.typeName?.name;
366
+ } else if (nodeAnnotation.type !== 'TSArrayType')
367
+ resultType = this._getTypeNameFromNode(nodeAnnotation);
368
+ else if (nodeAnnotation.elementType.type !== 'TSTypeReference') {
363
369
  isArray = true;
364
- resultType = this._getTypeNameFromNode(annotation?.elementType);
370
+ resultType = this._getTypeNameFromNode(nodeAnnotation?.elementType);
365
371
  } else {
366
372
  isArray = true;
367
373
  resultType =
368
- annotation?.elementType?.typeName?.name ||
369
- annotation?.elementType?.typeName?.right?.name;
374
+ nodeAnnotation?.elementType?.typeName?.name ||
375
+ nodeAnnotation?.elementType?.typeName?.right?.name;
370
376
  }
371
377
  }
372
378
  resultType = typesToAnnotation[resultType];