Skip to content

Commit fe349ea

Browse files
fix(tools): fix type errors in create-element template (#2873)
* 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 * docs: create dull-stingrays-film.md * chore: update package.json --------- Co-authored-by: Benny Powers - עם ישראל חי! <[email protected]>
1 parent e69f755 commit fe349ea

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.changeset/dull-stingrays-film.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@patternfly/create-element": patch
3+
---
4+
5+
Fixed type errors in create-element template

tools/create-element/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"bin": {
1212
"create-app": "bin/main.js"
1313
},
14+
"contributors": [
15+
"Martin Pitt <[email protected]>"
16+
],
1417
"keywords": [
1518
"custom elements",
1619
"custom-elements",

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)