Skip to content

Allow users to narrow down type #3

@BasixKOR

Description

@BasixKOR

Hi! Thank you for creating a great package. However, while using it, I noticed I couldn't narrow down the object types using standard TS type guards. For example, given an item: Track | Episode; I can't narrow it down to Track by simply checking item.type === "episode".

This happens because all interfaces share the same SpotifyType, which doesn't guarantee an Episode will always have a "episode" as a type.

Could we change them to simple literal types to benefit from type narrowing? I'd like to file a PR if you're interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    can implementThis feature or bug fix can be implemented

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions