Skip to content

Instantly share code, notes, and snippets.

@abinavseelan
Created October 31, 2020 18:21
Show Gist options
  • Save abinavseelan/b68d8e3c6da2fe1ccc35e1fdc96cf425 to your computer and use it in GitHub Desktop.
Save abinavseelan/b68d8e3c6da2fe1ccc35e1fdc96cf425 to your computer and use it in GitHub Desktop.
interface Schema {
posts: Array<{
id: number;
title: string;
views: number;
}>;
user: {
name: string;
};
}
// Users define their database schema. Here `db` is typed as `Schema`.
// However, our problem was ensuring that the user defined schema is valid JSON.
const db = new CasualDB<Schema>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment