Skip to content

Commit

Permalink
Fixed Lit vscode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoremus committed Apr 17, 2024
1 parent c53ae94 commit 50300e2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
4 changes: 4 additions & 0 deletions components/wc/LitAlertWC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import { css, html, LitElement } from "https://esm.sh/[email protected]";

export class CustomAlert extends LitElement {
// Needed for TypeScript since it does not recognize TS properties
// as class-level variables
icon = "";
theme = "";
static get styles() {
return css`
:host {
Expand Down
12 changes: 8 additions & 4 deletions components/wc/MyLitMessage.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { css, html, LitElement } from "https://esm.sh/[email protected]";

// @ts-ignore LSP does not recognize LitElement syntax
export class MyLitMessage extends LitElement {
// Needed for TypeScript since it does not recognize TS properties
// as class-level variables
message = "";
// Properties are the component attributes
static get properties(): { message: string } {
static get properties() {
return {
message: "",
message: { type: String, state: false },
};
}
static get styles() {
Expand All @@ -20,7 +22,9 @@ export class MyLitMessage extends LitElement {

render() {
return html`
<p>The message: <span class="message">${this.message}</span></p>
<p>The message:
<span class="message">${this.message}</span>
</p>
`;
}
}
Expand Down
13 changes: 11 additions & 2 deletions static/wc/wc.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,13 @@ l2?.({ LitElement: t });

// components/wc/MyLitMessage.ts
var MyLitMessage = class extends t {
// Needed for TypeScript since it does not recognize TS properties
// as class-level variables
message = "";
// Properties are the component attributes
static get properties() {
return {
message: ""
message: { type: String, state: false }
};
}
static get styles() {
Expand All @@ -624,7 +627,9 @@ var MyLitMessage = class extends t {
}
render() {
return X`
<p>The message: <span class="message">${this.message}</span></p>
<p>The message:
<span class="message">${this.message}</span>
</p>
`;
}
};
Expand Down Expand Up @@ -674,6 +679,10 @@ customElements.define(

// components/wc/LitAlertWC.ts
var CustomAlert = class extends t {
// Needed for TypeScript since it does not recognize TS properties
// as class-level variables
icon = "";
theme = "";
static get styles() {
return v`
:host {
Expand Down

0 comments on commit 50300e2

Please sign in to comment.