Skip to content

The rating type in my TypeScript project is currently a string, but it seems to be a good idea to represent the possible values more explicitly . #195

Description

@LinuxKunaL

image

Issue Summary:
The rating type in my TypeScript project is currently a string, but it seems to be a good idea to represent the possible values more explicitly, such as using specific types like 'star', 'heart', 'rocket', 'bell', or even a custom type. This will help improve TypeScript suggestions and make the code more predictable and type-safe.

Suggested Improvement:
Instead of allowing rating to be any string, it would be better to define a union type in TypeScript for the possible rating types. For example:

type? : 'star' | 'heart' | 'rocket' | 'bell' | 'custom';

This way, the rating prop or value can be restricted to one of these specific values, which will help developers get better auto-completion suggestions in their editor.

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