@vkontakte/api-schema-typescript-generator 0.13.2 → 0.15.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.
@@ -1,15 +1,16 @@
1
1
  import * as Schema from '../types/schema';
2
- import {
3
- Dictionary,
4
- ObjectType,
5
- RefsDictionary,
6
- } from '../types';
2
+ import { Dictionary, ObjectType, RefsDictionary } from '../types';
7
3
  import { generateEnumAsUnionType } from './enums';
8
4
  import { normalizeMethodInfo } from './methods';
9
5
  import { SchemaObject } from './SchemaObject';
10
6
  import {
11
- getInterfaceName, getMethodSection, getObjectNameByRef,
12
- getSectionFromObjectName, isMethodNeeded, isPatternProperty, prepareBuildDirectory,
7
+ getInterfaceName,
8
+ getMethodSection,
9
+ getObjectNameByRef,
10
+ getSectionFromObjectName,
11
+ isMethodNeeded,
12
+ isPatternProperty,
13
+ prepareBuildDirectory,
13
14
  prepareMethodsPattern,
14
15
  writeFile,
15
16
  } from '../helpers';
@@ -20,7 +21,8 @@ import {
20
21
  baseAPIParamsInterfaceName,
21
22
  baseBoolIntRef,
22
23
  baseOkResponseRef,
23
- basePropertyExistsRef, DEFAULT_API_VERSION,
24
+ basePropertyExistsRef,
25
+ DEFAULT_API_VERSION,
24
26
  newLineChar,
25
27
  } from '../constants';
26
28
  import path from 'path';
@@ -28,6 +30,7 @@ import { CommentCodeBlock } from './CommentCodeBlock';
28
30
  import { consoleLogError, consoleLogErrorAndExit, consoleLogInfo } from '../log';
29
31
  import { generateImportsBlock } from '../generator';
30
32
  import { generateTypeString } from './typeString';
33
+ import { ErrorInterface } from '../types/schema';
31
34
 
32
35
  interface APITypingsGeneratorOptions {
33
36
  needEmit: boolean;
@@ -47,6 +50,7 @@ interface APITypingsGeneratorOptions {
47
50
  methodsDefinitions: Schema.API;
48
51
  objects: Dictionary<SchemaObject>;
49
52
  responses: Dictionary<SchemaObject>;
53
+ errors: Dictionary<ErrorInterface>;
50
54
  }
51
55
 
52
56
  export class APITypingsGenerator {
@@ -59,6 +63,7 @@ export class APITypingsGenerator {
59
63
  this.methodsList = options.methodsDefinitions.methods || [];
60
64
  this.objects = this.convertJSONSchemaDictionary(options.objects);
61
65
  this.responses = this.convertJSONSchemaDictionary(options.responses);
66
+ this.errors = options.errors;
62
67
 
63
68
  this.visitedRefs = {};
64
69
  this.generatedObjects = {};
@@ -68,7 +73,7 @@ export class APITypingsGenerator {
68
73
 
69
74
  this.ignoredResponses = {
70
75
  'storage.get': {
71
- 'keysResponse': true,
76
+ keysResponse: true,
72
77
  },
73
78
  };
74
79
 
@@ -83,6 +88,7 @@ export class APITypingsGenerator {
83
88
  methodsList!: NonNullable<Schema.API['methods']>;
84
89
  objects!: Dictionary<SchemaObject>;
85
90
  responses!: Dictionary<SchemaObject>;
91
+ errors!: Dictionary<ErrorInterface>;
86
92
 
87
93
  visitedRefs!: Dictionary<boolean>;
88
94
  generatedObjects!: Dictionary<boolean>;
@@ -129,10 +135,7 @@ export class APITypingsGenerator {
129
135
  ...methodFile.imports,
130
136
  ...imports,
131
137
  },
132
- codeBlocks: [
133
- ...methodFile.codeBlocks,
134
- ...codeBlocks,
135
- ],
138
+ codeBlocks: [...methodFile.codeBlocks, ...codeBlocks],
136
139
  };
137
140
  }
138
141
 
@@ -192,10 +195,7 @@ export class APITypingsGenerator {
192
195
  }
193
196
 
194
197
  if (additionalProperties.length) {
195
- properties = [
196
- ...properties,
197
- ...additionalProperties,
198
- ];
198
+ properties = [...properties, ...additionalProperties];
199
199
  }
200
200
  });
201
201
  }
@@ -265,10 +265,7 @@ export class APITypingsGenerator {
265
265
  });
266
266
 
267
267
  return {
268
- codeBlocks: [
269
- ...codeBlocks,
270
- codeBlock,
271
- ],
268
+ codeBlocks: [...codeBlocks, codeBlock],
272
269
  imports,
273
270
  value: '',
274
271
  };
@@ -300,27 +297,27 @@ export class APITypingsGenerator {
300
297
 
301
298
  let result: GeneratorResultInterface | false = false;
302
299
 
303
- if (!object.type && object.ref) {
300
+ if (object.ref) {
304
301
  result = this.getPrimitiveInterfaceCode(object);
305
- }
306
-
307
- switch (object.type) {
308
- case 'object':
309
- result = this.getObjectInterfaceCode(object);
310
- break;
311
-
312
- case 'string':
313
- case 'number':
314
- case 'integer':
315
- case 'array':
316
- case 'boolean':
317
- result = this.getPrimitiveInterfaceCode(object);
318
- break;
319
-
320
- default:
321
- if (!result) {
322
- consoleLogErrorAndExit(getInterfaceName(object.name), 'Unknown type of object', object);
323
- }
302
+ } else {
303
+ switch (object.type) {
304
+ case 'object':
305
+ result = this.getObjectInterfaceCode(object);
306
+ break;
307
+
308
+ case 'string':
309
+ case 'number':
310
+ case 'integer':
311
+ case 'array':
312
+ case 'boolean':
313
+ result = this.getPrimitiveInterfaceCode(object);
314
+ break;
315
+
316
+ default:
317
+ if (!result) {
318
+ consoleLogErrorAndExit(getInterfaceName(object.name), 'Unknown type of object', object);
319
+ }
320
+ }
324
321
  }
325
322
 
326
323
  if (!result) {
@@ -338,12 +335,18 @@ export class APITypingsGenerator {
338
335
 
339
336
  if (stringCodeBlocks.length > 0) {
340
337
  const code = stringCodeBlocks.join(newLineChar.repeat(2));
341
- this.registerResultFile(path.join('objects', section, `${getInterfaceName(object.name)}.ts`), code);
338
+ this.registerResultFile(
339
+ path.join('objects', section, `${getInterfaceName(object.name)}.ts`),
340
+ code,
341
+ );
342
342
  }
343
343
 
344
344
  codeBlocks.forEach((codeBlock) => {
345
345
  if (codeBlock instanceof TypeCodeBlock && codeBlock.needExport && codeBlock.interfaceName) {
346
- this.registerExport(`./objects/${section}/${getInterfaceName(object.name)}.ts`, codeBlock.interfaceName);
346
+ this.registerExport(
347
+ `./objects/${section}/${getInterfaceName(object.name)}.ts`,
348
+ codeBlock.interfaceName,
349
+ );
347
350
  }
348
351
  });
349
352
 
@@ -399,7 +402,9 @@ export class APITypingsGenerator {
399
402
  imports: newImports,
400
403
  value,
401
404
  codeBlocks: newCodeBlocks,
402
- } = generateTypeString(property, this.objects, { needEnumNamesConstant: false });
405
+ } = generateTypeString(property, this.objects, {
406
+ needEnumNamesConstant: false,
407
+ });
403
408
 
404
409
  imports = { ...imports, ...newImports };
405
410
  codeBlocks = [...codeBlocks, ...newCodeBlocks];
@@ -432,11 +437,13 @@ export class APITypingsGenerator {
432
437
 
433
438
  if (object.enum) {
434
439
  const { codeBlocks: newCodeBlocks } = generateEnumAsUnionType(object);
435
- codeBlocks = [
436
- ...newCodeBlocks,
437
- ];
440
+ codeBlocks = [...newCodeBlocks];
438
441
  } else {
439
- const { imports: newImports, value, codeBlocks: newCodeBlocks } = generateTypeString(object, this.objects);
442
+ const {
443
+ imports: newImports,
444
+ value,
445
+ codeBlocks: newCodeBlocks,
446
+ } = generateTypeString(object, this.objects);
440
447
  const codeBlock = new TypeCodeBlock({
441
448
  type: TypeScriptCodeTypes.Type,
442
449
  refName: object.name,
@@ -448,11 +455,7 @@ export class APITypingsGenerator {
448
455
  });
449
456
 
450
457
  imports = newImports;
451
- codeBlocks = [
452
- ...codeBlocks,
453
- ...newCodeBlocks,
454
- codeBlock,
455
- ];
458
+ codeBlocks = [...codeBlocks, ...newCodeBlocks, codeBlock];
456
459
  }
457
460
 
458
461
  return {
@@ -462,13 +465,11 @@ export class APITypingsGenerator {
462
465
  };
463
466
  }
464
467
 
465
- private getResponseCodeBlockAsType(object: SchemaObject, response: SchemaObject): GeneratorResultInterface | false {
466
- const {
467
- imports,
468
- value,
469
- codeBlocks,
470
- description,
471
- } = generateTypeString(response, this.objects, {
468
+ private getResponseCodeBlockAsType(
469
+ object: SchemaObject,
470
+ response: SchemaObject,
471
+ ): GeneratorResultInterface | false {
472
+ const { imports, value, codeBlocks, description } = generateTypeString(response, this.objects, {
472
473
  objectParentName: ' ', // TODO: Refactor
473
474
  });
474
475
 
@@ -476,20 +477,14 @@ export class APITypingsGenerator {
476
477
  type: TypeScriptCodeTypes.Type,
477
478
  refName: object.name,
478
479
  interfaceName: getInterfaceName(object.name),
479
- description: [
480
- object.description,
481
- description || '',
482
- ].join(newLineChar),
480
+ description: [object.description, description || ''].join(newLineChar),
483
481
  needExport: true,
484
482
  properties: [],
485
483
  value,
486
484
  });
487
485
 
488
486
  return {
489
- codeBlocks: [
490
- ...codeBlocks,
491
- codeBlock,
492
- ],
487
+ codeBlocks: [...codeBlocks, codeBlock],
493
488
  imports,
494
489
  value: '',
495
490
  description,
@@ -576,17 +571,11 @@ export class APITypingsGenerator {
576
571
  // Comment with method name for visual sections in file
577
572
  const methodNameComment = new CommentCodeBlock([methodName]);
578
573
  if (method.description) {
579
- methodNameComment.appendLines([
580
- '',
581
- method.description,
582
- ]);
574
+ methodNameComment.appendLines(['', method.description]);
583
575
  }
584
576
  this.appendToFileMap(section, {}, [methodNameComment]);
585
577
 
586
- const {
587
- method: normalizedMethod,
588
- parameterRefs,
589
- } = normalizeMethodInfo(method);
578
+ const { method: normalizedMethod, parameterRefs } = normalizeMethodInfo(method);
590
579
 
591
580
  method = normalizedMethod;
592
581
  this.generateObjectsFromRefs(parameterRefs);
@@ -619,15 +608,48 @@ export class APITypingsGenerator {
619
608
  this.registerExport(`./methods/${section}`, codeBlock.interfaceName);
620
609
  }
621
610
  });
622
- const code = [
623
- generateImportsBlock(imports, null),
624
- ...codeBlocks,
625
- ];
611
+ const code = [generateImportsBlock(imports, null), ...codeBlocks];
626
612
 
627
- this.registerResultFile(path.join('methods', `${section}.ts`), code.join(newLineChar.repeat(2)));
613
+ this.registerResultFile(
614
+ path.join('methods', `${section}.ts`),
615
+ code.join(newLineChar.repeat(2)),
616
+ );
628
617
  });
629
618
  }
630
619
 
620
+ private generateErrors() {
621
+ consoleLogInfo('creating errors...');
622
+
623
+ const code: string[] = [];
624
+
625
+ Object.entries(this.errors)
626
+ .reduce<Array<ErrorInterface & { name: string }>>((acc, [name, error]) => {
627
+ acc.push({ name, ...error });
628
+ return acc;
629
+ }, [])
630
+ .sort((errorA, errorB) => {
631
+ return errorA.code - errorB.code;
632
+ })
633
+ .forEach((error) => {
634
+ const errorConstantName = error.name.toUpperCase();
635
+
636
+ code.push(
637
+ new TypeCodeBlock({
638
+ type: TypeScriptCodeTypes.Const,
639
+ interfaceName: errorConstantName,
640
+ needExport: true,
641
+ value: String(error.code),
642
+ properties: [],
643
+ description: [error.description, error.$comment || ''].join(newLineChar.repeat(2)),
644
+ }).toString(),
645
+ );
646
+
647
+ this.registerExport('./common/errors', errorConstantName);
648
+ });
649
+
650
+ this.registerResultFile(path.join('common', 'errors.ts'), code.join(newLineChar.repeat(2)));
651
+ }
652
+
631
653
  private createCommonTypes() {
632
654
  consoleLogInfo('creating common types...');
633
655
  const code: string[] = [];
@@ -708,6 +730,7 @@ export class APITypingsGenerator {
708
730
  consoleLogInfo('generate');
709
731
 
710
732
  this.generateMethods();
733
+ this.generateErrors();
711
734
 
712
735
  if (this.needEmit) {
713
736
  this.createCommonTypes();
@@ -10,19 +10,12 @@ export class CommentCodeBlock extends BaseCodeBlock {
10
10
  lines: string[];
11
11
 
12
12
  appendLines(lines: string[]) {
13
- this.lines = [
14
- ...this.lines,
15
- ...lines,
16
- ];
13
+ this.lines = [...this.lines, ...lines];
17
14
  }
18
15
 
19
16
  toString(): string {
20
17
  const inner = this.lines.map((line) => spaceChar + `* ${line}`.trim());
21
18
 
22
- return [
23
- '/**',
24
- ...inner,
25
- ' */',
26
- ].join(newLineChar);
19
+ return ['/**', ...inner, ' */'].join(newLineChar);
27
20
  }
28
21
  }
@@ -1,14 +1,16 @@
1
1
  import { EnumLikeArray } from '../types';
2
2
  import { isObject, isString } from '../utils';
3
- import {
4
- transformPatternPropertyName,
5
- } from '../helpers';
3
+ import { transformPatternPropertyName } from '../helpers';
6
4
  import { consoleLogErrorAndExit } from '../log';
7
5
 
8
6
  export class SchemaObject {
9
7
  constructor(name: string, object: any, parentName?: string) {
10
8
  if (!isObject(object)) {
11
- consoleLogErrorAndExit(`[SchemaObject] "${name}" is not an object.`, { name, object, parentName });
9
+ consoleLogErrorAndExit(`[SchemaObject] "${name}" is not an object.`, {
10
+ name,
11
+ object,
12
+ parentName,
13
+ });
12
14
  return;
13
15
  }
14
16
 
@@ -67,9 +69,13 @@ export class SchemaObject {
67
69
  }
68
70
 
69
71
  if (object.patternProperties) {
70
- Object.entries(object.patternProperties).forEach(([propertyName, property]: [string, any]) => {
71
- this.properties.push(new SchemaObject(transformPatternPropertyName(propertyName), property, name));
72
- });
72
+ Object.entries(object.patternProperties).forEach(
73
+ ([propertyName, property]: [string, any]) => {
74
+ this.properties.push(
75
+ new SchemaObject(transformPatternPropertyName(propertyName), property, name),
76
+ );
77
+ },
78
+ );
73
79
  }
74
80
 
75
81
  if (isObject(object.items)) {
@@ -112,6 +118,9 @@ export class SchemaObject {
112
118
  }
113
119
 
114
120
  public clone() {
115
- return Object.assign(Object.create(Object.getPrototypeOf(this)), this) as NonNullable<SchemaObject>;
121
+ return Object.assign(
122
+ Object.create(Object.getPrototypeOf(this)),
123
+ this,
124
+ ) as NonNullable<SchemaObject>;
116
125
  }
117
126
  }
@@ -9,6 +9,7 @@ export enum TypeScriptCodeTypes {
9
9
  Enum = 'enum',
10
10
  ConstantObject = 'constant_object',
11
11
  Type = 'type',
12
+ Const = 'const',
12
13
  }
13
14
 
14
15
  export interface TypeCodeBlockProperty {
@@ -63,41 +64,45 @@ export class TypeCodeBlock extends BaseCodeBlock {
63
64
  }
64
65
 
65
66
  private getPropertiesCode() {
66
- const quoteChar = this.properties.some((property) => areQuotesNeededForProperty(property.name)) ? '\'' : '';
67
-
68
- return this.properties.map((property) => {
69
- let divider = '';
70
- let lineEnd = '';
71
-
72
- switch (this.type) {
73
- case TypeScriptCodeTypes.Interface:
74
- divider = property.isRequired ? ':' : '?:';
75
- lineEnd = ';';
76
- break;
77
- case TypeScriptCodeTypes.ConstantObject:
78
- divider = ':';
79
- lineEnd = ',';
80
- break;
81
- case TypeScriptCodeTypes.Enum:
82
- divider = ' =';
83
- lineEnd = ',';
84
- break;
85
- }
67
+ const quoteChar = this.properties.some((property) => areQuotesNeededForProperty(property.name))
68
+ ? "'"
69
+ : '';
70
+
71
+ return this.properties
72
+ .map((property) => {
73
+ let divider = '';
74
+ let lineEnd = '';
75
+
76
+ switch (this.type) {
77
+ case TypeScriptCodeTypes.Interface:
78
+ divider = property.isRequired ? ':' : '?:';
79
+ lineEnd = ';';
80
+ break;
81
+ case TypeScriptCodeTypes.ConstantObject:
82
+ divider = ':';
83
+ lineEnd = ',';
84
+ break;
85
+ case TypeScriptCodeTypes.Enum:
86
+ divider = ' =';
87
+ lineEnd = ',';
88
+ break;
89
+ }
86
90
 
87
- let value = property.wrapValue ? quoteJavaScriptValue(property.value) : property.value;
88
- let propertyCode = [
89
- ` ${quoteChar}${property.name}${quoteChar}${divider} ${value}${lineEnd}`,
90
- ];
91
+ let value = property.wrapValue ? quoteJavaScriptValue(property.value) : property.value;
92
+ let propertyCode = [
93
+ ` ${quoteChar}${property.name}${quoteChar}${divider} ${value}${lineEnd}`,
94
+ ];
91
95
 
92
- if (property.description) {
93
- const commentLines = joinCommentLines(2, property.description);
94
- if (commentLines.length) {
95
- propertyCode.unshift(commentLines.join(newLineChar));
96
+ if (property.description) {
97
+ const commentLines = joinCommentLines(2, property.description);
98
+ if (commentLines.length) {
99
+ propertyCode.unshift(commentLines.join(newLineChar));
100
+ }
96
101
  }
97
- }
98
102
 
99
- return propertyCode.join(newLineChar);
100
- }).join(newLineChar);
103
+ return propertyCode.join(newLineChar);
104
+ })
105
+ .join(newLineChar);
101
106
  }
102
107
 
103
108
  toString(): string {
@@ -113,10 +118,7 @@ export class TypeCodeBlock extends BaseCodeBlock {
113
118
  }
114
119
 
115
120
  if (this.description) {
116
- before = [
117
- ...before,
118
- ...joinCommentLines(0, this.description),
119
- ];
121
+ before = [...before, ...joinCommentLines(0, this.description)];
120
122
  }
121
123
 
122
124
  switch (this.type) {
@@ -125,19 +127,19 @@ export class TypeCodeBlock extends BaseCodeBlock {
125
127
  if (this.options.allowEmptyInterface) {
126
128
  propertiesCode = '';
127
129
  } else {
128
- propertiesCode = [
129
- ' // empty interface',
130
- ' [key: string]: any;',
131
- ].join(newLineChar);
130
+ propertiesCode = [' // empty interface', ' [key: string]: any;'].join(newLineChar);
132
131
  }
133
132
  }
134
133
 
135
- const extendsInterfaces = Array.isArray(this.extendsInterfaces) && this.extendsInterfaces.length ?
136
- this.extendsInterfaces.join(', ') :
137
- '';
134
+ const extendsInterfaces =
135
+ Array.isArray(this.extendsInterfaces) && this.extendsInterfaces.length
136
+ ? this.extendsInterfaces.join(', ')
137
+ : '';
138
138
 
139
139
  code = [
140
- trimStringDoubleSpaces(`${exportKeyword} interface ${this.interfaceName} ${extendsInterfaces} {`),
140
+ trimStringDoubleSpaces(
141
+ `${exportKeyword} interface ${this.interfaceName} ${extendsInterfaces} {`,
142
+ ),
141
143
  propertiesCode,
142
144
  '}',
143
145
  ].join(propertiesCode.length ? newLineChar : '');
@@ -169,11 +171,18 @@ export class TypeCodeBlock extends BaseCodeBlock {
169
171
  trimStringDoubleSpaces(`${exportKeyword} type ${this.interfaceName} = ${this.value};`),
170
172
  ].join(newLineChar);
171
173
  break;
174
+
175
+ case TypeScriptCodeTypes.Const:
176
+ if (!this.value) {
177
+ consoleLogErrorAndExit(`"${this.interfaceName}" type has empty value`);
178
+ }
179
+
180
+ code = [
181
+ trimStringDoubleSpaces(`${exportKeyword} const ${this.interfaceName} = ${this.value};`),
182
+ ].join(newLineChar);
183
+ break;
172
184
  }
173
185
 
174
- return [
175
- before.join(newLineChar),
176
- code,
177
- ].join(newLineChar).trim();
186
+ return [before.join(newLineChar), code].join(newLineChar).trim();
178
187
  }
179
188
  }
@@ -18,7 +18,11 @@ export function getEnumNamesIdentifier(name: string) {
18
18
  return `${name} enumNames`.trim();
19
19
  }
20
20
 
21
- export function generateEnumConstantObject(object: SchemaObject, objectName: string, enumNames: Array<string | number>) {
21
+ export function generateEnumConstantObject(
22
+ object: SchemaObject,
23
+ objectName: string,
24
+ enumNames: Array<string | number>,
25
+ ) {
22
26
  const enumInterfaceName = getInterfaceName(objectName);
23
27
 
24
28
  const codeBlock = new TypeCodeBlock({
@@ -52,10 +56,7 @@ export function generateEnumAsUnionType(object: SchemaObject): GeneratorResultIn
52
56
  type: TypeScriptCodeTypes.Type,
53
57
  refName: object.name,
54
58
  interfaceName: getInterfaceName(object.name),
55
- description: [
56
- object.description,
57
- description,
58
- ].join(newLineChar),
59
+ description: [object.description, description].join(newLineChar),
59
60
  needExport: true,
60
61
  properties: [],
61
62
  value,
@@ -97,12 +98,11 @@ interface GenerateInlineEnumOptions {
97
98
  refName?: string;
98
99
  }
99
100
 
100
- export function generateInlineEnum(object: SchemaObject, options: GenerateInlineEnumOptions = {}): GeneratorResultInterface {
101
- const {
102
- isNumericEnum,
103
- enumNames,
104
- needEnumNamesDescription,
105
- } = getEnumNames(object);
101
+ export function generateInlineEnum(
102
+ object: SchemaObject,
103
+ options: GenerateInlineEnumOptions = {},
104
+ ): GeneratorResultInterface {
105
+ const { isNumericEnum, enumNames, needEnumNamesDescription } = getEnumNames(object);
106
106
 
107
107
  options = {
108
108
  needEnumNamesConstant: isNumericEnum,
@@ -37,9 +37,9 @@ export function normalizeMethodInfo(method: Schema.Method): NormalizeMethodInfoR
37
37
  const ref = parameter.items?.$ref;
38
38
  parameterRefs[ref] = RefsDictionaryType.Generate;
39
39
 
40
- parameter.description += newLineChar.repeat(2) + [
41
- `@see ${getInterfaceName(getObjectNameByRef(ref))} (${ref})`,
42
- ].join(newLineChar);
40
+ parameter.description +=
41
+ newLineChar.repeat(2) +
42
+ [`@see ${getInterfaceName(getObjectNameByRef(ref))} (${ref})`].join(newLineChar);
43
43
  }
44
44
  });
45
45
 
@@ -28,7 +28,10 @@ interface GenerateTypeStringOptions {
28
28
  needEnumNamesConstant?: boolean;
29
29
  }
30
30
 
31
- function generateBaseType(object: SchemaObject, options: GenerateTypeStringOptions): GeneratorResultInterface {
31
+ function generateBaseType(
32
+ object: SchemaObject,
33
+ options: GenerateTypeStringOptions,
34
+ ): GeneratorResultInterface {
32
35
  let codeBlocks: CodeBlocksArray = [];
33
36
  let typeString = 'any /* default type */';
34
37
  let imports: RefsDictionary = {};