Skip to content

Commit

Permalink
refactor(force-return-types): address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ferferga committed Jan 2, 2021
1 parent b2cc69c commit c409ac9
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 22 deletions.
7 changes: 6 additions & 1 deletion components/Buttons/UserButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@
import Vue from 'vue';
import { mapActions } from 'vuex';
interface MenuItem {
title: string;
action: () => void;
}
export default Vue.extend({
data() {
return {
avatarSize: 48
};
},
computed: {
menuItems(): Array<Record<never, never>> {
menuItems(): MenuItem[] {
return [
{
title: this.$t('logout'),
Expand Down
2 changes: 1 addition & 1 deletion components/Item/ItemGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default Vue.extend({
items: {
type: Array,
required: true,
default: (): Array<never> => {
default: (): BaseItemDto[] => {
return [];
}
},
Expand Down
6 changes: 3 additions & 3 deletions components/Item/Metadata/ImageEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@

<script lang="ts">
import Vue from 'vue';
import { ImageInfo, ImageType } from '@jellyfin/client-axios';
import { BaseItemDto, ImageInfo, ImageType } from '@jellyfin/client-axios';
import imageHelper from '~/mixins/imageHelper';
export default Vue.extend({
mixins: [imageHelper],
props: {
metadata: {
type: Object,
default: (): Record<never, never> => ({})
default: (): BaseItemDto => ({})
}
},
data() {
Expand All @@ -104,7 +104,7 @@ export default Vue.extend({
);
});
},
backdropImages(): Array<never> {
backdropImages(): ImageInfo[] {
return this.$data.images.filter((image: ImageInfo) => {
const { ImageType } = image;
return ImageType === 'Backdrop';
Expand Down
5 changes: 3 additions & 2 deletions components/Item/Metadata/ImageSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ import Vue from 'vue';
import {
ImageProviderInfo,
RemoteImageInfo,
ImageType
ImageType,
BaseItemDto
} from '@jellyfin/client-axios';
export default Vue.extend({
Expand All @@ -108,7 +109,7 @@ export default Vue.extend({
props: {
metadata: {
type: Object,
default: (): Record<never, never> => ({})
default: (): BaseItemDto => ({})
},
dialog: {
type: Boolean,
Expand Down
2 changes: 1 addition & 1 deletion components/Item/Metadata/PersonEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default Vue.extend({
props: {
person: {
type: Object,
default: (): Record<string, string> => ({
default: (): BaseItemPerson => ({
Name: '',
Type: '',
Role: ''
Expand Down
4 changes: 2 additions & 2 deletions components/Item/PersonList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@

<script lang="ts">
import Vue from 'vue';
import { ImageType } from '@jellyfin/client-axios';
import { BaseItemPerson, ImageType } from '@jellyfin/client-axios';
import imageHelper from '~/mixins/imageHelper';
export default Vue.extend({
mixins: [imageHelper],
props: {
items: {
type: Array,
default: (): Array<never> => {
default: (): BaseItemPerson[] => {
return [];
}
},
Expand Down
10 changes: 8 additions & 2 deletions layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ interface WebSocketMessage {
Data?: Record<string, never>;
}
interface LayoutButton {
icon: string;
title: string;
to: string;
}
export default Vue.extend({
data() {
return {
Expand All @@ -143,7 +149,7 @@ export default Vue.extend({
};
})
}),
items(): Array<Record<string, string>> {
items(): LayoutButton[] {
return [
{
icon: 'mdi-home',
Expand All @@ -152,7 +158,7 @@ export default Vue.extend({
}
];
},
configItems(): Array<Record<string, string>> {
configItems(): LayoutButton[] {
return [
{
icon: 'mdi-pencil-outline',
Expand Down
6 changes: 3 additions & 3 deletions pages/person/_itemId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default Vue.extend({
}
},
birthPlace: {
get(): null {
get(): string | null {
if (this.$data.item.ProductionLocations) {
return this.$data.item.ProductionLocations[0];
} else {
Expand All @@ -181,7 +181,7 @@ export default Vue.extend({
}
},
movies: {
get(): Array<Record<string, string>> {
get(): BaseItemDto[] {
return this.$data.appearances
.filter((appearance: BaseItemDto) => {
return appearance.Type === 'Movie';
Expand All @@ -190,7 +190,7 @@ export default Vue.extend({
}
},
shows: {
get(): Array<Record<string, string>> {
get(): BaseItemDto[] {
return this.$data.appearances
.filter((appearance: BaseItemDto) => {
return appearance.Type === 'Series';
Expand Down
4 changes: 1 addition & 3 deletions plugins/browserDetection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ class BrowserDetector {
* @memberof BrowserDetector
*/
isApple(): boolean {
return (navigator.vendor &&
navigator.vendor.includes('Apple') &&
!this.isTizen()) as boolean;
return navigator?.vendor.includes('Apple') && !this.isTizen();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions store/homeSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ type MutationPayload = {
};

export const getters: GetterTree<HomeSectionState, AppState> = {
getHomeSectionContent: (state) => (
section: HomeSection
): Array<never> | BaseItemDto | BaseItemDto[] => {
getHomeSectionContent: (state) => (section: HomeSection): BaseItemDto[] => {
switch (section.type) {
case 'libraries':
return state.libraries;
Expand Down
2 changes: 1 addition & 1 deletion store/tvShows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getters: GetterTree<TvShowsState, AppState> = {
itemId
}: {
itemId: string;
}): Array<BaseItemDto[]> => {
}): BaseItemDto[][] => {
return state[itemId]?.seasonEpisodes;
}
};
Expand Down

0 comments on commit c409ac9

Please sign in to comment.