@thisux/pockettypes
Version:
Generate TypeScript types from PocketBase collections with ease in seconds
64 lines (47 loc) • 1.02 kB
Markdown
from your PocketBase collections in seconds.
```bash
bun add pockettypes
```
1. Create a `.pocketbase.config.ts` file:
```ts
export default {
url: 'https://your-pb-instance.com',
username: 'admin@example.com',
password: 'your-password'
}
```
2. Generate types:
```bash
bun generate
```
This creates `pb.types.ts` with interfaces for all your collections:
```ts
interface Base {
id: string;
created: string;
updated: string;
}
interface User extends Base {
name: string;
avatar: string;
post_id: string;
}
interface Post extends Base {
title: string;
content: string;
author_id: string
}
```
- Generates TypeScript interfaces from PocketBase collections
- Handles relations with proper typing
- Supports all PocketBase field types
- Generates expand interfaces for relations
- Excludes views by default
- Adds proper nullability
- Supports custom fields
MIT © [thisuxhq](https://github.com/thisuxhq)
Generate TypeScript types