Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCHEMA INTERFACE #110

Open
PAINFUEG0 opened this issue Oct 23, 2024 · 1 comment
Open

SCHEMA INTERFACE #110

PAINFUEG0 opened this issue Oct 23, 2024 · 1 comment

Comments

@PAINFUEG0
Copy link

A type interface instead of schema would be really awesome.

interface SongSearchResponse {
  success: boolean; // Indicates whether the song search was successful
  data: {
    total: number;
    start: number;
    results: Array<{
      id: string;
      name: string;
      type: string;
      year: string | null;
      releaseDate: string | null;
      duration: number | null;
      label: string | null;
      explicitContent: boolean;
      playCount: number | null;
      language: string;
      hasLyrics: boolean;
      lyricsId: string | null;
      lyrics: {
        lyrics: string;
        copyright: string;
        snippet: string;
      };
      url: string;
      copyright: string | null;
      album: {
        id: string | null;
        name: string | null;
        url: string | null;
      };
      artists: {
        primary: Array<Artist>;
        featured: Array<Artist>;
        all: Array<Artist>;
      };
      image: Array<{
        quality: string;
        url: string;
      }>;
      downloadUrl: Array<{
        quality: string;
        url: string;
      }>;
    }>;
  };
}

interface Artist {
  id: string;
  name: string;
  role: string;
  type: string;
  image: Array<{
    quality: string;
    url: string;
  }>;
  url: string;
}

Please check this once

@shahil-yadav
Copy link

shahil-yadav commented Nov 6, 2024

Zod schema produces an interface underhood. For to use an interface, u have to develop own custom logic for type safety which is already done by the lib, so y reinvent the wheel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants