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
weaponId: string
position: number
mainhand?: boolean
uncapLevel?: number
transcendenceStep?: number
mainhand?: boolean | undefined
uncapLevel?: number | undefined
transcendenceStep?: number | undefined
}
export interface CreateGridCharacterParams {
partyId: string
characterId: string
position: number
uncapLevel?: number
transcendenceStep?: number
uncapLevel?: number | undefined
transcendenceStep?: number | undefined
}
export interface CreateGridSummonParams {
partyId: string
summonId: string
position: number
main?: boolean
friend?: boolean
quickSummon?: boolean
uncapLevel?: number
transcendenceStep?: number
main?: boolean | undefined
friend?: boolean | undefined
quickSummon?: boolean | undefined
uncapLevel?: number | undefined
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
*/
export interface CreatePartyParams {
name?: string
description?: string
visibility?: 'public' | 'private' | 'unlisted'
jobId?: string
raidId?: string
guidebookId?: string
extras?: Record<string, any>
name?: string | undefined
description?: string | undefined
visibility?: 'public' | 'private' | 'unlisted' | undefined
jobId?: string | undefined
raidId?: string | undefined
guidebookId?: string | undefined
extras?: Record<string, any> | undefined
}
/**

View file

@ -26,7 +26,25 @@ export const users = {
* Update user settings
*/
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 {
id: result.id,
username: result.username,

View file

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

View file

@ -39,13 +39,13 @@ export class GridService {
): Promise<GridUpdateResult> {
try {
// 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,
weaponId,
position,
mainhand: options?.mainhand,
transcendenceStep: 0
}), this.buildHeaders(editKey))
}, this.buildHeaders(editKey))
console.log('[GridService] Created grid weapon:', gridWeapon)
@ -208,14 +208,14 @@ export class GridService {
options?: { main?: boolean; friend?: boolean; shortcode?: string }
): Promise<Party> {
// 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,
summonId,
position,
main: options?.main,
friend: options?.friend,
transcendenceStep: 0
}), this.buildHeaders(editKey))
}, this.buildHeaders(editKey))
console.log('[GridService] Created grid summon:', gridSummon)

View file

@ -67,7 +67,7 @@ export class PartyService {
party: Party
editKey?: string
}> {
const apiPayload = optionalProps(this.mapToApiPayload(payload))
const apiPayload = this.mapToApiPayload(payload)
const party = await partyAdapter.create(apiPayload)
// 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
*/
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 })
}