diff --git a/core/static/bundled/utils/api.ts b/core/static/bundled/utils/api.ts index 5d72b3b6..af68511b 100644 --- a/core/static/bundled/utils/api.ts +++ b/core/static/bundled/utils/api.ts @@ -1,4 +1,4 @@ -import type { Client, Options, RequestResult } from "@hey-api/client-fetch"; +import type { Client, Options, RequestResult, TDataShape } from "@hey-api/client-fetch"; import { client } from "#openapi"; export interface PaginatedResponse { @@ -14,6 +14,7 @@ export interface PaginatedRequest { // biome-ignore lint/style/useNamingConvention: api is in snake_case page_size?: number; }; + url: string; } type PaginatedEndpoint = ( @@ -30,7 +31,7 @@ export const paginated = async ( options?: PaginatedRequest, ): Promise => { const maxPerPage = 199; - const queryParams = options ?? {}; + const queryParams = options ?? ({} as PaginatedRequest); queryParams.query = queryParams.query ?? {}; queryParams.query.page_size = maxPerPage; queryParams.query.page = 1; @@ -53,8 +54,9 @@ export const paginated = async ( return results; }; -interface Request { +interface Request extends TDataShape { client?: Client; + url: string; } interface InterceptorOptions { diff --git a/sas/static/bundled/sas/album-index.ts b/sas/static/bundled/sas/album-index.ts index c04df038..02e19fc9 100644 --- a/sas/static/bundled/sas/album-index.ts +++ b/sas/static/bundled/sas/album-index.ts @@ -1,6 +1,7 @@ import { paginated } from "#core:utils/api"; import { History, initialUrlParams, updateQueryString } from "#core:utils/history"; import { + type AlbumFetchAlbumData, type AlbumSchema, type PictureSchema, type PicturesFetchPicturesData, @@ -77,7 +78,7 @@ document.addEventListener("alpine:init", () => { this.albums = await paginated(albumFetchAlbum, { // biome-ignore lint/style/useNamingConvention: API is snake_case query: { parent_id: this.config.parentId }, - }); + } as AlbumFetchAlbumData); this.loading = false; }, })); diff --git a/tsconfig.json b/tsconfig.json index a93da92a..a980a1b8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,8 @@ "outDir": "./staticfiles/generated/bundled/", "sourceMap": true, "noImplicitAny": true, - "module": "es6", - "target": "es6", + "module": "esnext", + "target": "es2022", "allowJs": true, "moduleResolution": "node", "experimentalDecorators": true, @@ -12,7 +12,6 @@ "esModuleInterop": true, "resolveJsonModule": true, "types": ["jquery", "alpinejs"], - "lib": ["es7"], "paths": { "#openapi": ["./staticfiles/generated/openapi/index.ts"], "#core:*": ["./core/static/bundled/*"],