fix: add undefined to optional interface properties for exactOptionalPropertyTypes

- Update UserUpdateParams to include | undefined for all optional fields
- Add | undefined to CreatePartyParams and UpdatePartyParams interfaces
- Add | undefined to CreateGrid*Params interfaces (Weapon, Character, Summon)
- Transform UserUpdateParams to nested avatar structure in users.ts
- Remove unnecessary optionalProps wrappers (now handled by interface definitions)
- Fix TeamView awakening prop with conditional spreading

Reduces errors from 63 to 60.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-11-28 18:52:03 -08:00
parent 84be6ea30f
commit 5dc207dc9c
6 changed files with 47 additions and 25 deletions

View file

@ -21,28 +21,28 @@ export interface CreateGridWeaponParams {
partyId: string partyId: string
weaponId: string weaponId: string
position: number position: number
mainhand?: boolean mainhand?: boolean | undefined
uncapLevel?: number uncapLevel?: number | undefined
transcendenceStep?: number transcendenceStep?: number | undefined
} }
export interface CreateGridCharacterParams { export interface CreateGridCharacterParams {
partyId: string partyId: string
characterId: string characterId: string
position: number position: number
uncapLevel?: number uncapLevel?: number | undefined
transcendenceStep?: number transcendenceStep?: number | undefined
} }
export interface CreateGridSummonParams { export interface CreateGridSummonParams {
partyId: string partyId: string
summonId: string summonId: string
position: number position: number
main?: boolean main?: boolean | undefined
friend?: boolean friend?: boolean | undefined
quickSummon?: boolean quickSummon?: boolean | undefined
uncapLevel?: number uncapLevel?: number | undefined
transcendenceStep?: number transcendenceStep?: number | undefined
} }
/** /**

View file

@ -17,13 +17,13 @@ import type { Party, GridWeapon, GridCharacter, GridSummon } from '$lib/types/ap
* Parameters for creating a new party * Parameters for creating a new party
*/ */
export interface CreatePartyParams { export interface CreatePartyParams {
name?: string name?: string | undefined
description?: string description?: string | undefined
visibility?: 'public' | 'private' | 'unlisted' visibility?: 'public' | 'private' | 'unlisted' | undefined
jobId?: string jobId?: string | undefined
raidId?: string raidId?: string | undefined
guidebookId?: string guidebookId?: string | undefined
extras?: Record<string, any> extras?: Record<string, any> | undefined
} }
/** /**

View file

@ -26,7 +26,25 @@ export const users = {
* Update user settings * Update user settings
*/ */
update: async (userId: string, params: UserUpdateParams): Promise<UserResponse> => { update: async (userId: string, params: UserUpdateParams): Promise<UserResponse> => {
const result = await userAdapter.updateProfile(params) // Transform flat params to nested UserInfo structure
const updates: Partial<{
gender: number | undefined
language: string | undefined
theme: string | undefined
avatar: { picture?: string | undefined; element?: string | undefined }
}> = {}
if (params.gender !== undefined) updates.gender = params.gender
if (params.language !== undefined) updates.language = params.language
if (params.theme !== undefined) updates.theme = params.theme
if (params.picture !== undefined || params.element !== undefined) {
updates.avatar = {}
if (params.picture !== undefined) updates.avatar.picture = params.picture
if (params.element !== undefined) updates.avatar.element = params.element
}
const result = await userAdapter.updateProfile(updates)
return { return {
id: result.id, id: result.id,
username: result.username, username: result.username,

View file

@ -48,7 +48,11 @@
{#if modificationStatus.hasAwakening} {#if modificationStatus.hasAwakening}
<ModificationSection title="Awakening" visible={true}> <ModificationSection title="Awakening" visible={true}>
<AwakeningDisplay awakening={char.awakening} size="medium" showLevel={true} /> <AwakeningDisplay
{...(char.awakening ? { awakening: char.awakening } : {})}
size="medium"
showLevel={true}
/>
</ModificationSection> </ModificationSection>
{/if} {/if}

View file

@ -39,13 +39,13 @@ export class GridService {
): Promise<GridUpdateResult> { ): Promise<GridUpdateResult> {
try { try {
// Note: The backend computes the correct uncap level based on the weapon's FLB/ULB/transcendence flags // Note: The backend computes the correct uncap level based on the weapon's FLB/ULB/transcendence flags
const gridWeapon = await gridAdapter.createWeapon(optionalProps({ const gridWeapon = await gridAdapter.createWeapon({
partyId, partyId,
weaponId, weaponId,
position, position,
mainhand: options?.mainhand, mainhand: options?.mainhand,
transcendenceStep: 0 transcendenceStep: 0
}), this.buildHeaders(editKey)) }, this.buildHeaders(editKey))
console.log('[GridService] Created grid weapon:', gridWeapon) console.log('[GridService] Created grid weapon:', gridWeapon)
@ -208,14 +208,14 @@ export class GridService {
options?: { main?: boolean; friend?: boolean; shortcode?: string } options?: { main?: boolean; friend?: boolean; shortcode?: string }
): Promise<Party> { ): Promise<Party> {
// Note: The backend computes the correct uncap level based on the summon's FLB/ULB/transcendence flags // Note: The backend computes the correct uncap level based on the summon's FLB/ULB/transcendence flags
const gridSummon = await gridAdapter.createSummon(optionalProps({ const gridSummon = await gridAdapter.createSummon({
partyId, partyId,
summonId, summonId,
position, position,
main: options?.main, main: options?.main,
friend: options?.friend, friend: options?.friend,
transcendenceStep: 0 transcendenceStep: 0
}), this.buildHeaders(editKey)) }, this.buildHeaders(editKey))
console.log('[GridService] Created grid summon:', gridSummon) console.log('[GridService] Created grid summon:', gridSummon)

View file

@ -67,7 +67,7 @@ export class PartyService {
party: Party party: Party
editKey?: string editKey?: string
}> { }> {
const apiPayload = optionalProps(this.mapToApiPayload(payload)) const apiPayload = this.mapToApiPayload(payload)
const party = await partyAdapter.create(apiPayload) const party = await partyAdapter.create(apiPayload)
// Note: Edit key handling may need to be adjusted based on how the API returns it // Note: Edit key handling may need to be adjusted based on how the API returns it
@ -78,7 +78,7 @@ export class PartyService {
* Update party details * Update party details
*/ */
async update(id: string, payload: PartyUpdatePayload, editKey?: string): Promise<Party> { async update(id: string, payload: PartyUpdatePayload, editKey?: string): Promise<Party> {
const apiPayload = optionalProps(this.mapToApiPayload(payload)) const apiPayload = this.mapToApiPayload(payload)
return partyAdapter.update({ shortcode: id, ...apiPayload }) return partyAdapter.update({ shortcode: id, ...apiPayload })
} }