@@ -328,7 +328,7 @@ function toJsType(field) {
328328 if ( field . resolve ( ) . resolvedType instanceof Enum )
329329 type = field . resolvedType . fullName . substring ( 1 ) ; // reference the enum
330330 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
332332 else
333333 type = "*" ; // should not happen
334334 break ;
@@ -338,19 +338,13 @@ function toJsType(field) {
338338 : type ;
339339}
340340
341- function messageRef ( fullName ) {
342- return config [ "strict-message" ] || ! config . comments
343- ? fullName
344- : fullName + "$Properties" ;
345- }
346-
347341function buildType ( ref , type ) {
348342 var fullName = type . fullName . substring ( 1 ) ;
349343
350- if ( config . comments && ! config [ "strict-message" ] ) {
344+ if ( config . comments ) {
351345 var typeDef = [
352346 "Properties of " + aOrAn ( type . name ) + "." ,
353- "@typedef " + messageRef ( fullName ) ,
347+ "@typedef " + fullName + "$Properties" ,
354348 "@type {Object}"
355349 ] ;
356350 type . fieldsArray . forEach ( function ( field ) {
@@ -369,7 +363,7 @@ function buildType(ref, type) {
369363 type . comment ? "@classdesc " + type . comment : null ,
370364 "@exports " + fullName ,
371365 "@constructor" ,
372- "@param {" + messageRef ( fullName ) + "=} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set"
366+ "@param {" + fullName + "$Properties =} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set"
373367 ] ) ;
374368 buildFunction ( type , type . name , Class . generate ( type ) ) ;
375369
@@ -433,7 +427,7 @@ function buildType(ref, type) {
433427 push ( "" ) ;
434428 pushComment ( [
435429 "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" ,
437431 "@returns {" + fullName + "} " + type . name + " instance"
438432 ] ) ;
439433 push ( name ( type . name ) + ".create = function create(properties) {" ) ;
@@ -447,7 +441,7 @@ function buildType(ref, type) {
447441 push ( "" ) ;
448442 pushComment ( [
449443 "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" ,
451445 "@param {$protobuf.Writer} [" + ( config . beautify ? "writer" : "w" ) + "] Writer to encode to" ,
452446 "@returns {$protobuf.Writer} Writer"
453447 ] ) ;
@@ -457,7 +451,7 @@ function buildType(ref, type) {
457451 push ( "" ) ;
458452 pushComment ( [
459453 "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" ,
461455 "@param {$protobuf.Writer} [writer] Writer to encode to" ,
462456 "@returns {$protobuf.Writer} Writer"
463457 ] ) ;
0 commit comments