From 04c7df8ac846524bb670789aa39810d5e1b52499 Mon Sep 17 00:00:00 2001 From: imperosol Date: Fri, 7 Mar 2025 17:56:08 +0100 Subject: [PATCH] fix typescript types --- core/static/bundled/utils/api.ts | 1 - counter/static/bundled/counter/product-list-index.ts | 2 +- sas/static/bundled/sas/album-index.ts | 12 ++++-------- sas/static/bundled/sas/user/pictures-index.ts | 8 +++----- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/core/static/bundled/utils/api.ts b/core/static/bundled/utils/api.ts index af68511b..225337b0 100644 --- a/core/static/bundled/utils/api.ts +++ b/core/static/bundled/utils/api.ts @@ -56,7 +56,6 @@ export const paginated = async ( interface Request extends TDataShape { client?: Client; - url: string; } interface InterceptorOptions { diff --git a/counter/static/bundled/counter/product-list-index.ts b/counter/static/bundled/counter/product-list-index.ts index af45a1e3..a7cd3f86 100644 --- a/counter/static/bundled/counter/product-list-index.ts +++ b/counter/static/bundled/counter/product-list-index.ts @@ -108,7 +108,7 @@ document.addEventListener("alpine:init", () => { * Build the object containing the query parameters corresponding * to the current filters */ - getQueryParams(): ProductSearchProductsDetailedData { + getQueryParams(): Omit { const search = this.search.length > 0 ? this.search : null; // If active or archived products must be filtered, put the filter in the request // Else, don't include the filter diff --git a/sas/static/bundled/sas/album-index.ts b/sas/static/bundled/sas/album-index.ts index 02e19fc9..6dda1ce9 100644 --- a/sas/static/bundled/sas/album-index.ts +++ b/sas/static/bundled/sas/album-index.ts @@ -24,7 +24,6 @@ document.addEventListener("alpine:init", () => { page: Number.parseInt(initialUrlParams.get("page")) || 1, pushstate: History.Push /* Used to avoid pushing a state on a back action */, loading: false, - config: config, async init() { await this.fetchPictures(); @@ -51,11 +50,9 @@ document.addEventListener("alpine:init", () => { async fetchPictures() { this.loading = true; this.pictures = await paginated(picturesFetchPictures, { - query: { - // biome-ignore lint/style/useNamingConvention: API is in snake_case - album_id: config.albumId, - } as PicturesFetchPicturesData["query"], - }); + // biome-ignore lint/style/useNamingConvention: API is in snake_case + query: { album_id: config.albumId }, + } as PicturesFetchPicturesData); this.loading = false; }, @@ -66,7 +63,6 @@ document.addEventListener("alpine:init", () => { Alpine.data("albums", (config: SubAlbumsConfig) => ({ albums: [] as AlbumSchema[], - config: config, loading: false, async init() { @@ -77,7 +73,7 @@ document.addEventListener("alpine:init", () => { this.loading = true; this.albums = await paginated(albumFetchAlbum, { // biome-ignore lint/style/useNamingConvention: API is snake_case - query: { parent_id: this.config.parentId }, + query: { parent_id: config.parentId }, } as AlbumFetchAlbumData); this.loading = false; }, diff --git a/sas/static/bundled/sas/user/pictures-index.ts b/sas/static/bundled/sas/user/pictures-index.ts index d3cd83ae..a18dede5 100644 --- a/sas/static/bundled/sas/user/pictures-index.ts +++ b/sas/static/bundled/sas/user/pictures-index.ts @@ -17,11 +17,9 @@ document.addEventListener("alpine:init", () => { async init() { this.pictures = await paginated(picturesFetchPictures, { - query: { - // biome-ignore lint/style/useNamingConvention: from python api - users_identified: [config.userId], - } as PicturesFetchPicturesData["query"], - }); + // biome-ignore lint/style/useNamingConvention: from python api + query: { users_identified: [config.userId] }, + } as PicturesFetchPicturesData); this.albums = this.pictures.reduce( (acc: Record, picture: PictureSchema) => {