rss-parser icon indicating copy to clipboard operation
rss-parser copied to clipboard

Incorrect types for customFields.feed?

Open tunniclm opened this issue 6 months ago • 0 comments

Version: [email protected]

The following code works as expected but fails to compile under Typescript:

import Parser from 'rss-parser';

const parser = new Parser({
    customFields: {
        feed: [['dc:language', 'language']]
    }
});

Typescript error: Type '[string, string]' is not assignable to type 'string | number'. ts(2322)

It feels like this should be allowed for a few reasons:

  • The README reads like it should work (no special case to say feed is more restricted that item)
  • The default fields defined in lib/fields.js use these types of values (eg ['dc:publisher', 'publisher'])
  • It does appear to work correctly when ignoring the Typescript error

tunniclm avatar Jul 04 '25 10:07 tunniclm