diff --git a/src/field.js b/src/field.js index 05d89cae8..20c1cd27d 100644 --- a/src/field.js +++ b/src/field.js @@ -78,13 +78,13 @@ function Field(name, id, type, rule, extend, options, comment) { if (extend !== undefined && !util.isString(extend)) throw TypeError("extend must be a string"); + if (rule === "proto3_optional") { + rule = "optional"; + } /** * Field rule, if any. * @type {string|undefined} */ - if (rule === "proto3_optional") { - rule = "optional"; - } this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON /**