Skip to content

Commit b27da42

Browse files
committed
fix(tools): fix type errors in create-element template
Commit c9bd577 enabled `isolatedDeclarations`, which introduced these errors in `npm new` generated components: > TS9008: Method must have an explicit return type annotation with --isolatedDeclarations. > render() { > > TS9017: Only const arrays can be inferred with --isolatedDeclarations. > static readonly styles = [styles]; Fixes #2872
1 parent 9637998 commit b27da42

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/create-element/templates/element/element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LitElement, html } from 'lit';
1+
import { LitElement, html, type TemplateResult } from 'lit';
22
import { customElement } from 'lit/decorators/custom-element.js';
33

44
import styles from '<%= cssRelativePath %>';
@@ -9,9 +9,9 @@ import styles from '<%= cssRelativePath %>';
99
*/
1010
@customElement('<%= tagName %>')
1111
export class <%= className %> extends LitElement {
12-
static readonly styles = [styles];
12+
static readonly styles: CSSStyleSheet[] = [styles];
1313

14-
render() {
14+
render(): TemplateResult<1> {
1515
return html`
1616
<slot></slot>
1717
`;

0 commit comments

Comments
 (0)