Skip to content

Item.categories not matching declared type #289

@aste-mikkok

Description

@aste-mikkok

https://github.com/rbren/rss-parser/blob/master/index.d.ts declares Item.categories to be an array of strings. This is incorrect if the RSS XML tag includes attributes.

import Parser from 'rss-parser';
const parser = new Parser();
const feed = await parser.parseURL('https://github.blog/changelog/feed/');
console.log(feed.items[0].categories);

prints

[
  [Object: null prototype] {
    _: 'Release',
    '$': [Object: null prototype] { domain: 'changelog-type' }
  },
  [Object: null prototype] {
    _: 'copilot',
    '$': [Object: null prototype] { domain: 'changelog-label' }
  }
]

The RSS item content being

<item>
 ....
 <category domain="changelog-type">Release</category>
 <category domain="changelog-label">copilot</category>
</item>

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