From b27da42994655936b58e84ca8eff263a62b7fba1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 8 Nov 2024 11:51:49 +0100 Subject: [PATCH 1/3] fix(tools): fix type errors in create-element template Commit c9bd577f3 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 --- tools/create-element/templates/element/element.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/create-element/templates/element/element.ts b/tools/create-element/templates/element/element.ts index 8f35f9fcab..5c9ff8db26 100644 --- a/tools/create-element/templates/element/element.ts +++ b/tools/create-element/templates/element/element.ts @@ -1,4 +1,4 @@ -import { LitElement, html } from 'lit'; +import { LitElement, html, type TemplateResult } from 'lit'; import { customElement } from 'lit/decorators/custom-element.js'; import styles from '<%= cssRelativePath %>'; @@ -9,9 +9,9 @@ import styles from '<%= cssRelativePath %>'; */ @customElement('<%= tagName %>') export class <%= className %> extends LitElement { - static readonly styles = [styles]; + static readonly styles: CSSStyleSheet[] = [styles]; - render() { + render(): TemplateResult<1> { return html` `; From 63e3e9e6119ebf7593258d5854801c4b7ba0d9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benny=20Powers=20-=20=D7=A2=D7=9D=20=D7=99=D7=A9=D7=A8?= =?UTF-8?q?=D7=90=D7=9C=20=D7=97=D7=99!?= Date: Sun, 10 Nov 2024 08:29:36 +0200 Subject: [PATCH 2/3] docs: create dull-stingrays-film.md --- .changeset/dull-stingrays-film.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/dull-stingrays-film.md diff --git a/.changeset/dull-stingrays-film.md b/.changeset/dull-stingrays-film.md new file mode 100644 index 0000000000..f2e53738ee --- /dev/null +++ b/.changeset/dull-stingrays-film.md @@ -0,0 +1,5 @@ +--- +"@patternfly/create-element": patch +--- + +Fixed type errors in create-element template From 7f8abd9b606d8308e39051646fbd0971ffdf4fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benny=20Powers=20-=20=D7=A2=D7=9D=20=D7=99=D7=A9=D7=A8?= =?UTF-8?q?=D7=90=D7=9C=20=D7=97=D7=99!?= Date: Sun, 10 Nov 2024 08:40:26 +0200 Subject: [PATCH 3/3] chore: update package.json --- tools/create-element/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/create-element/package.json b/tools/create-element/package.json index 7499387bdd..94216e0f1f 100644 --- a/tools/create-element/package.json +++ b/tools/create-element/package.json @@ -11,6 +11,9 @@ "bin": { "create-app": "bin/main.js" }, + "contributors": [ + "Martin Pitt " + ], "keywords": [ "custom elements", "custom-elements",