@@ -42,7 +42,13 @@ function writeMessage(ctx, options) {
42
42
if ( ! options . noRead ) {
43
43
const readName = `read${ name } ` ;
44
44
if ( options . jsDoc ) {
45
- code += [ '\n/**' , ' * @param {Pbf} pbf' , ' * @param {number} [end]' , ` * @returns {${ name } }` , ' */' ] . join ( '\n' ) . concat ( '\n' ) ;
45
+ code += `
46
+ /**
47
+ * @param {Pbf} pbf
48
+ * @param {number} [end]
49
+ * @returns {${ name } }
50
+ */
51
+ ` ;
46
52
}
47
53
code +=
48
54
`${ writeFunctionExport ( options , readName ) } function ${ readName } (pbf, end) {
@@ -55,7 +61,13 @@ function writeMessage(ctx, options) {
55
61
const { key, value} = getMapTsType ( fields ) ;
56
62
param = `{key: ${ key } ; value: ${ value } }` ;
57
63
}
58
- code += [ '\n/**' , ' * @param {number} tag' , ` * @param {${ param } } obj` , ' * @param {Pbf} pbf' , ' */' ] . join ( '\n' ) . concat ( '\n' ) ;
64
+ code += `
65
+ /**
66
+ * @param {number} tag
67
+ * @param {${ param } } obj
68
+ * @param {Pbf} pbf
69
+ */
70
+ ` ;
59
71
}
60
72
code +=
61
73
`function ${ readName } Field(tag, obj, pbf) {
@@ -93,7 +105,12 @@ function writeMessage(ctx, options) {
93
105
param = `{key: ${ key } ; value: ${ value } }` ;
94
106
}
95
107
96
- code += [ '\n/**' , ` * @param {${ param } } obj` , ' * @param {Pbf} pbf' , ' */' ] . join ( '\n' ) . concat ( '\n' ) ;
108
+ code += `
109
+ /**
110
+ * @param {${ param } } obj
111
+ * @param {Pbf} pbf
112
+ */
113
+ ` ;
97
114
}
98
115
99
116
code += `${ writeFunctionExport ( options , writeName ) } function ${ writeName } (obj, pbf) {\n` ;
@@ -480,12 +497,6 @@ function getMapTsType(fields) {
480
497
return { key, value} ;
481
498
}
482
499
483
- /**
484
- * @param {string } type
485
- * @param {string } name
486
- * @param {{name: string; type: string; required: boolean} } [fields]
487
- * @returns {string }
488
- */
489
500
function typeDef ( type , name , fields = [ ] ) {
490
501
const unionProperties = { } ;
491
502
const properties = fields . map ( ( field ) => {
@@ -512,16 +523,10 @@ function typeDef(type, name, fields = []) {
512
523
. concat ( '\n' ) ;
513
524
}
514
525
515
- /**
516
- * @param {object } ctx
517
- * @param {string } name
518
- * @param {{name: string; type: string; required: boolean} } [fields]
519
- * @returns {string }
520
- */
521
526
function compileType ( ctx , name , fields = [ ] ) {
522
527
if ( ctx . _proto . map ) {
523
528
const { key, value} = getMapTsType ( fields ) ;
524
- return typeDef ( `Object <${ key } , ${ value } >` , name , [ ] ) ;
529
+ return typeDef ( `Record <${ key } , ${ value } >` , name , [ ] ) ;
525
530
}
526
531
527
532
const typedFields = fields . map ( ( field ) => {
0 commit comments