@@ -328,7 +328,7 @@ function toJsType(field) {
328
328
if ( field . resolve ( ) . resolvedType instanceof Enum )
329
329
type = field . resolvedType . fullName . substring ( 1 ) ; // reference the enum
330
330
else if ( field . resolvedType instanceof Type )
331
- type = messageRef ( field . resolvedType . fullName . substring ( 1 ) ) ; // reference the interface
331
+ type = field . resolvedType . fullName . substring ( 1 ) + ( config [ "strict-message" ] ? "" : "$Properties" ) ; // reference the typedef
332
332
else
333
333
type = "*" ; // should not happen
334
334
break ;
@@ -338,19 +338,13 @@ function toJsType(field) {
338
338
: type ;
339
339
}
340
340
341
- function messageRef ( fullName ) {
342
- return config [ "strict-message" ] || ! config . comments
343
- ? fullName
344
- : fullName + "$Properties" ;
345
- }
346
-
347
341
function buildType ( ref , type ) {
348
342
var fullName = type . fullName . substring ( 1 ) ;
349
343
350
- if ( config . comments && ! config [ "strict-message" ] ) {
344
+ if ( config . comments ) {
351
345
var typeDef = [
352
346
"Properties of " + aOrAn ( type . name ) + "." ,
353
- "@typedef " + messageRef ( fullName ) ,
347
+ "@typedef " + fullName + "$Properties" ,
354
348
"@type {Object}"
355
349
] ;
356
350
type . fieldsArray . forEach ( function ( field ) {
@@ -369,7 +363,7 @@ function buildType(ref, type) {
369
363
type . comment ? "@classdesc " + type . comment : null ,
370
364
"@exports " + fullName ,
371
365
"@constructor" ,
372
- "@param {" + messageRef ( fullName ) + "=} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set"
366
+ "@param {" + fullName + "$Properties =} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set"
373
367
] ) ;
374
368
buildFunction ( type , type . name , Class . generate ( type ) ) ;
375
369
@@ -433,7 +427,7 @@ function buildType(ref, type) {
433
427
push ( "" ) ;
434
428
pushComment ( [
435
429
"Creates a new " + type . name + " instance using the specified properties." ,
436
- "@param {" + messageRef ( fullName ) + "=} [properties] Properties to set" ,
430
+ "@param {" + fullName + "$Properties =} [properties] Properties to set" ,
437
431
"@returns {" + fullName + "} " + type . name + " instance"
438
432
] ) ;
439
433
push ( name ( type . name ) + ".create = function create(properties) {" ) ;
@@ -447,7 +441,7 @@ function buildType(ref, type) {
447
441
push ( "" ) ;
448
442
pushComment ( [
449
443
"Encodes the specified " + type . name + " message. Does not implicitly {@link " + fullName + ".verify|verify} messages." ,
450
- "@param {" + messageRef ( fullName ) + "} " + ( config . beautify ? "message" : "m" ) + " " + type . name + " message or plain object to encode" ,
444
+ "@param {" + fullName + ( config [ "strict-message" ] ? "" : "$Properties" ) + "} " + ( config . beautify ? "message" : "m" ) + " " + type . name + " message or plain object to encode" ,
451
445
"@param {$protobuf.Writer} [" + ( config . beautify ? "writer" : "w" ) + "] Writer to encode to" ,
452
446
"@returns {$protobuf.Writer} Writer"
453
447
] ) ;
@@ -457,7 +451,7 @@ function buildType(ref, type) {
457
451
push ( "" ) ;
458
452
pushComment ( [
459
453
"Encodes the specified " + type . name + " message, length delimited. Does not implicitly {@link " + fullName + ".verify|verify} messages." ,
460
- "@param {" + messageRef ( fullName ) + "} message " + type . name + " message or plain object to encode" ,
454
+ "@param {" + fullName + ( config [ "strict-message" ] ? "" : "$Properties" ) + "} message " + type . name + " message or plain object to encode" ,
461
455
"@param {$protobuf.Writer} [writer] Writer to encode to" ,
462
456
"@returns {$protobuf.Writer} Writer"
463
457
] ) ;
0 commit comments