Skip to content

Incorrect types for customFields.feed? #285

Description

@tunniclm

Version: rss-parser@3.13.0

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions