Skip to content

Commit 1043096

Browse files
committed
Demonstrate state as optional in controller guidelines
In various examples in the controller guidelines, the `state` controller option was not optional, even though there is a guideline that says it should be. This commit updates the documentation so that it shown as optional.
1 parent a1100c2 commit 1043096

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/writing-controllers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class FooController extends BaseController</* ... */> {
4949
state = {},
5050
}: {
5151
messenger: FooControllerMessenger;
52-
state: Partial<FooControllerState>;
52+
state?: Partial<FooControllerState>;
5353
}) {
5454
super({
5555
// ...
@@ -87,7 +87,7 @@ class FooController extends BaseController</* ... */> {
8787
state = {},
8888
}: {
8989
messenger: FooControllerMessenger;
90-
state: Partial<FooControllerState>;
90+
state?: Partial<FooControllerState>;
9191
}) {
9292
super({
9393
name,
@@ -158,7 +158,7 @@ class FooController extends BaseController</* ... */> {
158158
state = {},
159159
}: {
160160
messenger: FooControllerMessenger;
161-
state: Partial<FooControllerState>;
161+
state?: Partial<FooControllerState>;
162162
},
163163
isEnabled: boolean,
164164
) {
@@ -177,7 +177,7 @@ class FooController extends BaseController</* ... */> {
177177
isEnabled,
178178
}: {
179179
messenger: FooControllerMessenger;
180-
state: Partial<FooControllerState>;
180+
state?: Partial<FooControllerState>;
181181
isEnabled: boolean;
182182
}) {
183183
// ...

0 commit comments

Comments
 (0)