File tree 2 files changed +60
-0
lines changed
2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ ## TS1341
2
+
3
+ > error TS1341: Class constructor may not be an accessor.
4
+
5
+ ### Broken Code ❌
6
+
7
+ ``` ts
8
+ class SomeClass {
9
+ get constructor() {
10
+ // ...
11
+ }
12
+ set constructor(value ) {
13
+ // ...
14
+ }
15
+ }
16
+ ```
17
+
18
+ ### Fixed Code ✔️
19
+
20
+ You can't name accessors as ` constructor ` :
21
+
22
+ <!-- prettier-ignore-start -->
23
+ {% codeblock lang: ts mark:2,5 %}
24
+ class SomeClass {
25
+ get builder() {
26
+ // ...
27
+ }
28
+ set builder(value) {
29
+ // ...
30
+ }
31
+ }
32
+ {% endcodeblock %}
33
+ <!-- prettier-ignore-end -->
Original file line number Diff line number Diff line change
1
+ ## TS1368
2
+
3
+ > error TS1368: Class constructor may not be a generator.
4
+
5
+ ### Broken Code ❌
6
+
7
+ ``` ts
8
+ class SomeClass {
9
+ * constructor() {
10
+ // ...
11
+ }
12
+ }
13
+ ```
14
+
15
+ ### Fixed Code ✔️
16
+
17
+ You can't name generators as ` constructor ` :
18
+
19
+ <!-- prettier-ignore-start -->
20
+ {% codeblock lang: ts mark:2 %}
21
+ class SomeClass {
22
+ * builder() {
23
+ // ...
24
+ }
25
+ }
26
+ {% endcodeblock %}
27
+ <!-- prettier-ignore-end -->
You can’t perform that action at this time.
0 commit comments