Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created September 27, 2024 13:00
Show Gist options
  • Save peterbe/84994f0b71e947a5b62754cdc36fb76b to your computer and use it in GitHub Desktop.
Save peterbe/84994f0b71e947a5b62754cdc36fb76b to your computer and use it in GitHub Desktop.
export interface ApiV0 {
blogitems: {
id: number;
oid: string;
title: string;
pub_date: string;
categories:
| []
| [
{
id: number;
name: string;
[k: string]: unknown;
}
];
keywords: [] | [string] | [string, string];
_is_published: boolean;
modify_date?: string;
summary?: string;
archived?: string | null;
}[];
count: number;
}
@peterbe
Copy link
Author

peterbe commented Sep 27, 2024

How I'd WANT it to look like had I done this manually:

interface Category {
  id: number;
  name: string;
}

interface Blogitem {
  id: number;
  oid: string;
  title: string;
  pub_date: string;
  categories: Category[]
  keywords: string[];
  _is_published: boolean;
  modify_date?: string;
  summary?: string;
  archived?: string | null;
}

export interface ApiV0 {
  blogitems: Blogitem[];
  count: number;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment