Skip to content

Commit

Permalink
Merge pull request #52 from RDFLib/edmond/fix-ts-errors
Browse files Browse the repository at this point in the history
Fix typescript errors for vocab item list component
  • Loading branch information
nicholascar authored May 10, 2023
2 parents dfbc643 + 1e7a3b6 commit 7ccb75e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/VocabItemList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { reactive, watch, ref } from "vue";
import { RouterLink } from "vue-router";
import ItemListSortButton from "@/components/ItemListSortButton.vue";
import type { ListItem, listingTableColumn } from "@/types";
import type { VocabListItem, listingTableColumn } from "@/types";
const props = defineProps<{
items: ListItem[];
items: VocabListItem[];
childName?: string;
childLink?: string;
}>();
Expand Down Expand Up @@ -61,19 +61,21 @@ watch(sortState, () => {
for (const validKey of validKeys) {
if (sortState[validKey] === true) {
rows.value = props.items.sort((a: ListItem, b: ListItem) => {
rows.value = props.items.sort((a: VocabListItem, b: VocabListItem) => {
const listItemKey = keyToListItem[validKey];
if (a.hasOwnProperty(listItemKey)) {
return a[listItemKey].localeCompare(b[listItemKey]);
return (a[listItemKey] as string).localeCompare(b[listItemKey] as string);
}
return 0;
})
}
else if (sortState[validKey] === false) {
rows.value = props.items.sort((a: ListItem, b: ListItem) => {
rows.value = props.items.sort((a: VocabListItem, b: VocabListItem) => {
const listItemKey = keyToListItem[validKey];
if (b.hasOwnProperty(listItemKey)) {
return b[listItemKey].localeCompare(a[listItemKey]);
return (b[listItemKey] as string).localeCompare(a[listItemKey] as string);
}
return 0;
})
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export interface VocabListItem {
type?: string;
status?: string;
derivationMode?: string;
[key: string]: string | undefined;
};

export interface AnnotatedPredicate {
Expand Down

0 comments on commit 7ccb75e

Please sign in to comment.