Skip to content

Commit 3f5b910

Browse files
authoredJul 28, 2021
docs: update constructor declaration for enum-like class in "Design Guidelines" (aws#15520)
Fix constructor issue with enum like class examples ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 76fb481 commit 3f5b910

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎docs/DESIGN_GUIDELINES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -610,14 +610,14 @@ A pattern for an "Enum-like Class" should be used in such cases:
610610

611611
```ts
612612
export interface MyProps {
613-
option: MyOption;
613+
readonly option: MyOption;
614614
}
615615

616616
export class MyOption {
617617
public static COMMON_OPTION_1 = new MyOption('common.option-1');
618618
public static COMMON_OPTION_2 = new MyOption('common.option-2');
619619

620-
public MyOption(public readonly customValue: string) { }
620+
public constructor(public readonly customValue: string) { }
621621
}
622622
```
623623

@@ -644,7 +644,7 @@ export class MyOption {
644644

645645
// 'protected' iso. 'private' so that someone that really wants to can still
646646
// do subclassing. But maybe might as well be private.
647-
protected MyOption(public readonly value: string) { }
647+
protected constructor(public readonly value: string) { }
648648
}
649649

650650
// Usage

0 commit comments

Comments
 (0)
Please sign in to comment.