From 20ed4cc255530be08da84b141d808fb4fbe381fc Mon Sep 17 00:00:00 2001 From: Zongyi Zheng Date: Thu, 3 Aug 2017 01:48:02 +0800 Subject: [PATCH] add example of optional property Fixes: https://github.com/jsdoc3/jsdoc3.github.com/issues/172 --- content/en/tags-property.md | 14 ++++++++++++++ tags-property.html | 15 +++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/content/en/tags-property.md b/content/en/tags-property.md index 1d1d4462..a14b9984 100644 --- a/content/en/tags-property.md +++ b/content/en/tags-property.md @@ -50,3 +50,17 @@ var config = { }; ``` {% endexample %} + +The following example shows how to indicate that a property is optional. + + {% example "A type definition with required and optional property" %} + + ``` +/** + * User type definition + * @typedef {Object} User + * @property {string} email + * @property {string} [nickName] + */ + ``` + {% endexample %} \ No newline at end of file diff --git a/tags-property.html b/tags-property.html index 26b08e8a..fcf66e0b 100644 --- a/tags-property.html +++ b/tags-property.html @@ -69,8 +69,16 @@

Examples

} } }; - - + +

The following example shows how to indicate that a property is optional.

+
+
A type definition with required and optional property
/**
+ * User type definition
+ * @typedef {Object} User
+ * @property {string} email
+ * @property {string} [nickName]
+ */
+