Skip to content

track.album sometimes is undefined #53

@cabraviva

Description

@cabraviva

Hey there @scriptex , thanks for the package!

On some less popular songs trackApi.getInfo() returns a track where .album is undefined. This probably is a limitation of the API, and not of your package, so no need to change that. However, the unexpected type change to undefined is not properly described in the typescript schema. Thus, this project looses its type safety. I would appreciate marking .album as optional in the TS schemes to fix this.

Here's an example script to test what I mean:

import { LastFMTrack } from 'lastfm-ts-api'
import config from '../../../../../config'

const trackApi = new LastFMTrack(
    config.metadataProviders.lastfm.clientId ?? '',
    config.metadataProviders.lastfm.clientSecret
)

const trackInfo = await trackApi.getInfo({
    track: 'Bella Napoli',
    artist: 'DJ Robin'
})

console.log(trackInfo.track.album)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions