Skip to content

Commit 812f059

Browse files
authored
Merge pull request #224 from github/improve-docs-around-no-minifier
Improve docs around manual naming to avoid minifier mangling
2 parents 5a3a1c3 + afc9b4a commit 812f059

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

docs/_guide/you-will-need.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,22 @@ class UserList extends HTMLElement {
7373
}
7474
```
7575

76-
TypeScript decorators only support _class declarations_ which means you will still need to keep the class name between `class` and `extends`. For example the following will be a SyntaxError:
76+
TypeScript will need the `useDefineForClassFields` set to `true` for the above to work, alternatively you can use the following syntax with `useDefineForClassFields` kept off:
7777

7878
```ts
7979
@controller
80-
class extends HTMLElement {
80+
class UserList extends HTMLElement {
81+
static get name() { return 'UserList' }
82+
}
83+
```
84+
85+
You'll need to keep the class name either way. TypeScript decorators only support _class declarations_ which require a name between `class` and `extends`. For example the following will be a SyntaxError:
86+
87+
```ts
88+
@controller
89+
class extends HTMLElement { // You can't do this!
8190
static name = 'UserList'
8291
}
8392
```
93+
94+

0 commit comments

Comments
 (0)