diff --git a/src/lib/api/adapters/base.adapter.ts b/src/lib/api/adapters/base.adapter.ts index 4e2ad2d5..b97cfb5d 100644 --- a/src/lib/api/adapters/base.adapter.ts +++ b/src/lib/api/adapters/base.adapter.ts @@ -19,7 +19,6 @@ import { } from './errors' import { authStore } from '$lib/stores/auth.store' import { browser } from '$app/environment' -import { optionalProps } from '$lib/utils/typeShims' /** * Base adapter class that all resource-specific adapters extend from. @@ -125,9 +124,9 @@ export abstract class BaseAdapter { } } - // Prepare request options (filter out undefined to satisfy exactOptionalPropertyTypes) + // Prepare request options const fetchOptions: RequestInit = { - ...optionalProps(options), // Allow overriding defaults, filter undefined + ...options, // Allow overriding defaults credentials: 'include', // Still include cookies for CORS and refresh token signal: controller.signal, headers: { diff --git a/src/lib/api/resources/users.ts b/src/lib/api/resources/users.ts index 88daaa28..93a3eb00 100644 --- a/src/lib/api/resources/users.ts +++ b/src/lib/api/resources/users.ts @@ -1,5 +1,4 @@ import { userAdapter } from '../adapters/user.adapter' -import { optionalProps } from '$lib/utils/typeShims' export interface UserUpdateParams { picture?: string | undefined diff --git a/src/lib/components/UserSettingsModal.svelte b/src/lib/components/UserSettingsModal.svelte index 42781f05..6effcd5a 100644 --- a/src/lib/components/UserSettingsModal.svelte +++ b/src/lib/components/UserSettingsModal.svelte @@ -10,7 +10,6 @@ import type { UserCookie } from '$lib/types/UserCookie' import { setUserCookie } from '$lib/auth/cookies' import { invalidateAll } from '$app/navigation' - import { optionalProps } from '$lib/utils/typeShims' interface Props { open: boolean @@ -73,14 +72,14 @@ saving = true try { - // Prepare the update data (filter undefined to satisfy exactOptionalPropertyTypes) - const updateData = optionalProps({ + // Prepare the update data + const updateData = { picture, element: currentPicture?.element, gender, language, theme - }) + } // Call API to update user settings const response = await users.update(userId, updateData) diff --git a/src/lib/composables/drag-drop.svelte.ts b/src/lib/composables/drag-drop.svelte.ts index f1b27aa5..2bf709d1 100644 --- a/src/lib/composables/drag-drop.svelte.ts +++ b/src/lib/composables/drag-drop.svelte.ts @@ -1,5 +1,4 @@ import type { GridCharacter, GridWeapon, GridSummon } from '$lib/types/api/party' -import { optionalProps } from '$lib/utils/typeShims' export type GridItemType = 'character' | 'weapon' | 'summon' export type GridItem = GridCharacter | GridWeapon | GridSummon @@ -225,12 +224,12 @@ export function createDragDropContext(handlers: DragDropHandlers = {}) { itemId: state.draggedItem.data.id, type: state.draggedItem.source.type }, - target: optionalProps({ + target: { container: state.hoveredOver.container, position: state.hoveredOver.position, itemId: targetItem?.id, type: state.hoveredOver.type - }), + }, status: 'pending', retryCount: 0 } diff --git a/src/lib/services/grid.service.ts b/src/lib/services/grid.service.ts index 03175b46..66181197 100644 --- a/src/lib/services/grid.service.ts +++ b/src/lib/services/grid.service.ts @@ -1,7 +1,6 @@ import type { Party, GridWeapon, GridSummon, GridCharacter } from '$lib/types/api/party' import { gridAdapter } from '$lib/api/adapters/grid.adapter' import { partyAdapter } from '$lib/api/adapters/party.adapter' -import { optionalProps } from '$lib/utils/typeShims' export interface GridOperation { type: 'add' | 'replace' | 'remove' | 'move' | 'swap' @@ -123,12 +122,12 @@ export class GridService { editKey?: string, options?: { shortcode?: string } ): Promise { - await gridAdapter.updateWeapon(gridWeaponId, optionalProps({ + await gridAdapter.updateWeapon(gridWeaponId, { position: updates.position, uncapLevel: updates.uncapLevel, transcendenceStep: updates.transcendenceStep, element: updates.element - }), this.buildHeaders(editKey)) + }, this.buildHeaders(editKey)) // Clear party cache if shortcode provided if (options?.shortcode) { @@ -271,12 +270,12 @@ export class GridService { editKey?: string, options?: { shortcode?: string } ): Promise { - await gridAdapter.updateSummon(gridSummonId, optionalProps({ + await gridAdapter.updateSummon(gridSummonId, { position: updates.position, quickSummon: updates.quickSummon, uncapLevel: updates.uncapLevel, transcendenceStep: updates.transcendenceStep - }), this.buildHeaders(editKey)) + }, this.buildHeaders(editKey)) // Clear party cache if shortcode provided if (options?.shortcode) { @@ -437,12 +436,12 @@ export class GridService { editKey?: string, options?: { shortcode?: string } ): Promise { - const updated = await gridAdapter.updateCharacter(gridCharacterId, optionalProps({ + const updated = await gridAdapter.updateCharacter(gridCharacterId, { position: updates.position, uncapLevel: updates.uncapLevel, transcendenceStep: updates.transcendenceStep, perpetuity: updates.perpetuity - }), this.buildHeaders(editKey)) + }, this.buildHeaders(editKey)) // Clear party cache if shortcode provided if (options?.shortcode) { diff --git a/src/lib/services/party.service.ts b/src/lib/services/party.service.ts index 436addcb..5703313b 100644 --- a/src/lib/services/party.service.ts +++ b/src/lib/services/party.service.ts @@ -2,7 +2,6 @@ import type { Party } from '$lib/types/api/party' import { partyAdapter } from '$lib/api/adapters/party.adapter' import { authStore } from '$lib/stores/auth.store' import { browser } from '$app/environment' -import { optionalProps } from '$lib/utils/typeShims' /** * Context type for party-related operations in components