Fix missed rename, and improve types (#276)
Fixes a missed rename, in `src/item-index.ts`: I'd renamed `coll` to `item` but missed updating it in the `update` method's `changedProperties` map. This PR fixes that, and adds better typing to all of the instances of `changedProperties` by using [`PropertyValues<this>`](https://lit.dev/docs/components/lifecycle/#typescript-types-for-changedproperties), and implementing class properties for missing Lit properties.
This commit is contained in:
+4
-4
@@ -1,4 +1,4 @@
|
||||
import { LitElement, html, css } from "lit";
|
||||
import { LitElement, html, css, type PropertyValues } from "lit";
|
||||
import { property } from "lit/decorators.js";
|
||||
import { ref, createRef, type Ref } from "lit/directives/ref.js";
|
||||
import type {
|
||||
@@ -51,7 +51,7 @@ import fasCaretDown from "@fortawesome/fontawesome-free/svgs/solid/caret-down.sv
|
||||
import { RWPEmbedReceipt } from "./embed-receipt";
|
||||
import Split from "split.js";
|
||||
|
||||
import type { Item as ItemInfo } from "./types";
|
||||
import type { Item as ItemType } from "./types";
|
||||
import type { Replay } from "./replay";
|
||||
import { ifDefined } from "lit/directives/if-defined.js";
|
||||
|
||||
@@ -93,7 +93,7 @@ class Item extends LitElement {
|
||||
showSidebar: boolean | null = null;
|
||||
|
||||
@property({ type: Object, attribute: false })
|
||||
itemInfo: ItemInfo | Record<string, never> | null = null;
|
||||
itemInfo: ItemType | Record<string, never> | null = null;
|
||||
|
||||
@property({ type: String })
|
||||
item = "";
|
||||
@@ -265,7 +265,7 @@ class Item extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
updated(changedProperties) {
|
||||
updated(changedProperties: PropertyValues<this>) {
|
||||
// if (changedProperties.has("url") || changedProperties.has("ts")) {
|
||||
// if (this.url.startsWith("rwp?")) {
|
||||
// this.tabData = Object.fromEntries(new URLSearchParams(this.url.slice(4)).entries());
|
||||
|
||||
Reference in New Issue
Block a user