Skip to content

Commit 6545cd6

Browse files
authored
feat: add TS1341 and TS1368 sections (#1)
1 parent d06af76 commit 6545cd6

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

errors/includes/TS1xxx/TS1341.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 -->

errors/includes/TS1xxx/TS1368.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 -->

0 commit comments

Comments
 (0)