File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -169,9 +169,21 @@ API docs.
169
169
170
170
171
171
#### Getters and Setters
172
+ * Avoid long or complex getters and setters. If the logic of an accessor would take more than
173
+ three lines, introduce a new method to contain the logic.
174
+ * A getter should immediately precede its corresponding setter.
175
+ * Decorators such as ` @Input ` should be applied to the getter and not the setter.
172
176
* Always use a ` readonly ` property instead of a getter (with no setter) when possible.
173
- * Avoid long getters and setters. If the logic of an accessor would take more than three lines,
174
- introduce a new method to contain the logic.
177
+ ``` ts
178
+ /** YES */
179
+ readonly active : boolean ;
180
+
181
+ /** NO */
182
+ get active (): boolean {
183
+ // Using a getter solely to make the property read-only.
184
+ return this ._active ;
185
+ }
186
+ ```
175
187
176
188
#### JsDoc comments
177
189
You can’t perform that action at this time.
0 commit comments