mirror of
https://github.com/jellyfin/jellyfin-vue.git
synced 2024-12-03 11:41:09 +00:00
fix(types): some errors
Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
parent
ccded13292
commit
8984a2d639
@ -35,7 +35,7 @@ import playbackProfile from '@/utils/playback-profiles';
|
||||
import { msToTicks } from '@/utils/time';
|
||||
import { mediaControls, mediaElementRef } from '@/store';
|
||||
import { CommonStore } from '@/store/super/common-store';
|
||||
import { genericWorker } from '@/plugins/workers';
|
||||
import { shuffle } from '@/utils/data-manipulation';
|
||||
|
||||
/**
|
||||
* == INTERFACES AND TYPES ==
|
||||
@ -173,7 +173,7 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
|
||||
* Get reactive BaseItemDto's objects of the queue
|
||||
*/
|
||||
public get queue(): BaseItemDto[] {
|
||||
return apiStore.getItemsById(this._state.queue) as BaseItemDto[] ?? [];
|
||||
return apiStore.getItemsById(this._state.queue) as BaseItemDto[];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -776,7 +776,7 @@ class PlaybackManagerStore extends CommonStore<PlaybackManagerState> {
|
||||
this._state.originalQueue = [];
|
||||
this._state.isShuffling = false;
|
||||
} else {
|
||||
const queue = await genericWorker.shuffle(toRaw(this._state.queue));
|
||||
const queue = await shuffle(this._state.queue);
|
||||
|
||||
this._state.originalQueue = this._state.queue;
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { defu } from 'defu';
|
||||
import { toRaw } from 'vue';
|
||||
import { genericWorker } from '@/plugins/workers';
|
||||
|
||||
/**
|
||||
* Merge 2 objects, excluding the keys from the destination that are not present in source
|
||||
@ -68,3 +70,13 @@ export function pick<T extends object>(object: T, keys: (keyof T)[]): Partial<T>
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuffles an array in a WebWorker using the Durstenfeld shuffle algorithm, an
|
||||
* optimized version of Fisher-Yates shuffle.
|
||||
*
|
||||
* It's also prepared for the case when the array is reactive thorugh Vue's `ref` or `reactive`.
|
||||
*/
|
||||
export async function shuffle<T>(array: T[]): Promise<T[]> {
|
||||
return await genericWorker.shuffle(toRaw(array)) as T[];
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ export function isStr(value: unknown): value is string {
|
||||
/**
|
||||
* Check if the given value is a funcion
|
||||
*/
|
||||
export function isFunc<T extends (...args: unknown[]) => unknown>(value: unknown): value is T {
|
||||
export function isFunc(value: unknown): value is (...args: unknown[]) => unknown {
|
||||
return typeof value === 'function';
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ export function isArray(object: unknown): object is unknown[] {
|
||||
*
|
||||
* @type TypeScript Decorator
|
||||
*/
|
||||
export function sealed<T extends new(...args: unknown[]) => unknown>(constructor: T): void {
|
||||
export function sealed(constructor: new (...args: never[]) => object): void {
|
||||
Object.seal(constructor);
|
||||
Object.seal(constructor.prototype);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user