Skip to content

Export types in feed #128

Closed
Closed
@gustavkj

Description

@gustavkj

Is your feature request related to a problem? Please describe.
Right now, only the Feed class is exported as a type. It would be nice if the types used for the parameters of different methods and the constructor were exported to.

Describe the solution you'd like
Export the following types: Author, Extension, FeedOptions, and Item.

Describe alternatives you've considered
In the meantime, I'm getting the type from the typing of the parameters. Which I do not think is as nice, though:

import { Feed } from 'feed';

type Item = Parameters<Feed['addItem']>[0];

It's also possible to get the type by importing from the typings directory, but it do not think this is an intended feature (right?):

import { Item } from 'feed/lib/typings';

Additional context

For reference, feed.d.ts looks like this as of 4.2.1:

import { Author, Extension, FeedOptions, Item } from "./typings";
export declare class Feed {
    options: FeedOptions;
    items: Item[];
    categories: string[];
    contributors: Author[];
    extensions: Extension[];
    constructor(options: FeedOptions);
    addItem: (item: Item) => number;
    addCategory: (category: string) => number;
    addContributor: (contributor: Author) => number;
    addExtension: (extension: Extension) => number;
    atom1: () => string;
    rss2: () => string;
    json1: () => string;
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions