diff --git a/src/lib/types/apple-music.ts b/src/lib/types/apple-music.ts index 2b117de..5644684 100644 --- a/src/lib/types/apple-music.ts +++ b/src/lib/types/apple-music.ts @@ -40,6 +40,13 @@ export interface AppleMusicAttributes { url: string } +export interface AppleMusicArtistAttributes { + name: string + artwork?: AppleMusicArtwork + genreNames?: string[] + url?: string +} + export interface AppleMusicTrackAttributes { albumName: string artistName: string @@ -64,7 +71,7 @@ export interface AppleMusicTrackAttributes { export interface AppleMusicRelationships { artists?: { - data: AppleMusicResource[] + data: AppleMusicResource[] href?: string next?: string } @@ -117,16 +124,33 @@ export interface AppleMusicErrorResponse { } // Type guards -export function isAppleMusicError(response: any): response is AppleMusicErrorResponse { - return response && 'errors' in response && Array.isArray(response.errors) +export function isAppleMusicError(response: unknown): response is AppleMusicErrorResponse { + return ( + typeof response === 'object' && + response !== null && + 'errors' in response && + Array.isArray((response as AppleMusicErrorResponse).errors) + ) } -export function isAppleMusicAlbum(resource: any): resource is AppleMusicAlbum { - return resource && resource.type === 'albums' && 'attributes' in resource +export function isAppleMusicAlbum(resource: unknown): resource is AppleMusicAlbum { + return ( + typeof resource === 'object' && + resource !== null && + 'type' in resource && + (resource as AppleMusicAlbum).type === 'albums' && + 'attributes' in resource + ) } -export function isAppleMusicTrack(resource: any): resource is AppleMusicTrack { - return resource && resource.type === 'songs' && 'attributes' in resource +export function isAppleMusicTrack(resource: unknown): resource is AppleMusicTrack { + return ( + typeof resource === 'object' && + resource !== null && + 'type' in resource && + (resource as AppleMusicTrack).type === 'songs' && + 'attributes' in resource + ) } // Helper function to get high-resolution artwork URL diff --git a/src/lib/types/editor.ts b/src/lib/types/editor.ts index 11e9cb4..6671944 100644 --- a/src/lib/types/editor.ts +++ b/src/lib/types/editor.ts @@ -20,7 +20,7 @@ export interface EditorBlock { items?: string[] caption?: string url?: string - [key: string]: any + [key: string]: unknown } } @@ -33,11 +33,11 @@ export interface EditorSaveData { // Tiptap/Edra content nodes export interface TiptapNode { type: string - attrs?: Record + attrs?: Record content?: TiptapNode[] marks?: Array<{ type: string - attrs?: Record + attrs?: Record }> text?: string } diff --git a/src/lib/types/lastfm.ts b/src/lib/types/lastfm.ts index 06a6ded..81c4b33 100644 --- a/src/lib/types/lastfm.ts +++ b/src/lib/types/lastfm.ts @@ -39,7 +39,10 @@ export interface Album { trackCount?: number recordLabel?: string copyright?: string - editorialNotes?: any + editorialNotes?: { + short?: string + standard?: string + } isComplete?: boolean tracks?: Array<{ name: string @@ -51,7 +54,7 @@ export interface Album { searchQuery?: string storefront?: string responseTime?: number - rawResponse?: any + rawResponse?: unknown matchType?: 'exact' | 'fuzzy' | 'single' searchAttempts?: number } diff --git a/src/lib/types/photos.ts b/src/lib/types/photos.ts index 4a6da12..4dab3c4 100644 --- a/src/lib/types/photos.ts +++ b/src/lib/types/photos.ts @@ -9,6 +9,12 @@ export interface ExifData { location?: string } +export interface ColorPalette { + hex?: string + rgb?: [number, number, number] + population?: number +} + export interface Photo { id: string src: string @@ -17,7 +23,7 @@ export interface Photo { width: number height: number dominantColor?: string - colors?: any + colors?: ColorPalette[] aspectRatio?: number exif?: ExifData createdAt?: string diff --git a/src/lib/types/project.ts b/src/lib/types/project.ts index 720f66b..a3dd406 100644 --- a/src/lib/types/project.ts +++ b/src/lib/types/project.ts @@ -1,3 +1,5 @@ +import type { EditorData } from './editor' + export type ProjectStatus = 'draft' | 'published' | 'list-only' | 'password-protected' export type ProjectType = 'work' | 'labs' @@ -13,7 +15,7 @@ export interface Project { featuredImage: string | null logoUrl: string | null externalUrl: string | null - caseStudyContent: any | null + caseStudyContent: EditorData | null backgroundColor: string | null highlightColor: string | null projectType: ProjectType @@ -43,7 +45,7 @@ export interface ProjectFormData { logoUrl: string status: ProjectStatus password: string - caseStudyContent: any + caseStudyContent: EditorData showFeaturedImageInHeader: boolean showBackgroundColorInHeader: boolean showLogoInHeader: boolean