File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,24 @@ be part of the user-facing API. This typically applies to symbols used in templa
154
154
Additionally, the ` @docs-private ` JsDoc annotation can be used to hide any symbol from the public
155
155
API docs.
156
156
157
+
158
+ #### Getters and Setters
159
+ * Avoid long or complex getters and setters. If the logic of an accessor would take more than
160
+ three lines, introduce a new method to contain the logic.
161
+ * A getter should immediately precede its corresponding setter.
162
+ * Decorators such as ` @Input ` should be applied to the getter and not the setter.
163
+ * Always use a ` readonly ` property instead of a getter (with no setter) when possible.
164
+ ``` ts
165
+ /** YES */
166
+ readonly active : boolean ;
167
+
168
+ /** NO */
169
+ get active (): boolean {
170
+ // Using a getter solely to make the property read-only.
171
+ return this ._active ;
172
+ }
173
+ ```
174
+
157
175
#### JsDoc comments
158
176
159
177
All public APIs must have user-facing comments. These are extracted and shown in the documentation
You can’t perform that action at this time.
0 commit comments