eidoriantan / mp3tag.js

MP3 tagging library written in pure JavaScript for Node.js and browsers
https://mp3tag.js.org
MIT License
85 stars 9 forks source link

[BUG] Wrong types in typescript definition ? #633

Closed RedHeadEmile closed 9 months ago

RedHeadEmile commented 9 months ago

I am using the APIC frames in my application and something seemed weird to me.

In tags.d.ts:

export interface MP3TagTagsV2Defined {
  v2: {
    APIC?: frames.MP3TagAPICFrame;
    COMM?: Array<frames.MP3TagLangDescFrame>;
    ETCO?: frames.MP3TagETCOFrame;
    GEOB?: Array<frames.MP3TagGEOBFrame>;
    IPLS?: Array<string>;
    MCDI?: frames.MP3TagMCDIFRame;
    OWNE?: frames.MP3TagOWNEFrame;
    PCNT?: frames.MP3TagTextFrame;
    POPM?: Array<frames.MP3TagPOPMFrame>;
    PRIV?: Array<frames.MP3TagPRIVFrame>;
    ...

Shouldn't the APIC variable be an array ?

Because to make it works, I have to do:

const apicFrames = mp3tag.tags.v2?.APIC as unknown as Array<frames.MP3TagAPICFrame> | undefined;

Thanks in advance

eidoriantan commented 9 months ago

Thank you for reporting! Yes, APIC frame should be an array

eidoriantan commented 9 months ago

Should be fixed in v3.7.2