Permalink
Browse files

Respect optional properties when writing interfaces in tsd-jsdoc, fixes

  • Loading branch information...
dcodeIO committed Dec 30, 2016
1 parent 1f18453 commit 7eb3d456370d7d66b0856e32b2d2602abf598516
Showing with 12 additions and 8 deletions.
  1. +4 −1 lib/tsd-jsdoc/publish.js
  2. +8 −7 types/protobuf.js.d.ts
@@ -275,7 +275,10 @@ function writeInterface(element) {
writeln("interface ", element.name, " {");
++indent;
element.properties.forEach(function(property) {
writeln(property.name, ": ", getTypeOf(property), ";");
write(property.name);
if (property.optional)
write("?");
writeln(": ", getTypeOf(property), ";");
});
--indent;
writeln("}");
@@ -1,5 +1,6 @@
// $> pbts --name protobufjs --out types/protobuf.js.d.ts src
// Generated Fri, 30 Dec 2016 00:51:27 UTC
// Generated Fri, 30 Dec 2016 12:09:31 UTC
declare module "protobufjs" {
/**
@@ -131,11 +132,11 @@ declare module "protobufjs" {
* @property {boolean} [defaults=false] Also sets default values on the resulting object
*/
interface JSONConversionOptions {
fieldsOnly: boolean;
longs: any;
enums: any;
bytes: any;
defaults: boolean;
fieldsOnly?: boolean;
longs?: any;
enums?: any;
bytes?: any;
defaults?: boolean;
}
/**
@@ -145,7 +146,7 @@ declare module "protobufjs" {
* @property {boolean} [fieldsOnly=false] Keeps only properties that reference a field
*/
interface MessageConversionOptions {
fieldsOnly: boolean;
fieldsOnly?: boolean;
}
/**

0 comments on commit 7eb3d45

Please sign in to comment.