← Files Base44ARCHIVED FILE
skills/base44-cli/references/types-generate.md
2.84 KB · Sep 30, 2026 · 23:18 UTC
# `base44 types generate`
Generate TypeScript declaration file (`types.d.ts`) from project resources (entities, functions, agents, connectors).
## Usage
```bash
npx base44 types generate
```
## What It Does
1. **Reads project configuration** — Scans `base44/entities/`, `base44/functions/`, `base44/agents/`, and `base44/connectors/` for all defined resources
2. **Generates `base44/.types/types.d.ts`** — Creates a TypeScript declaration file that augments the `@base44/sdk` module with typed registries
3. **Updates `tsconfig.json`** (if present) — Automatically adds `base44/.types/*.d.ts` to the `include` array so TypeScript picks up the generated types
## Authentication
**Not required.** This command runs entirely locally and does not need authentication.
## Output File
The generated file is placed at:
```
base44/.types/types.d.ts
```
### Generated Content
The declaration file augments the `@base44/sdk` module with four registries:
- **`EntityTypeRegistry`** — Maps entity names to their TypeScript interfaces (compiled from entity JSON schemas)
- **`FunctionNameRegistry`** — Lists all backend function names
- **`AgentNameRegistry`** — Lists all agent names
- **`ConnectorTypeRegistry`** — Lists all connector types
**Example output:**
```typescript
// Auto-generated by Base44 CLI - DO NOT EDIT
// Regenerate with: base44 types generate
export interface Task {
title: string;
status: "todo" | "in_progress" | "done";
assignee?: string;
}
export interface Board {
name: string;
description?: string;
}
declare module '@base44/sdk' {
interface EntityTypeRegistry {
"Task": Task;
"Board": Board;
}
interface FunctionNameRegistry {
"send_email": true;
}
interface AgentNameRegistry {
"support_agent": true;
}
interface ConnectorTypeRegistry {
"googlecalendar": true;
}
}
```
If no resources are found, the file contains a placeholder with instructions on how to add resources.
## tsconfig.json Integration
If a `tsconfig.json` exists in the project root, the command automatically adds `base44/.types/*.d.ts` to the `include` array:
```json
{
"include": [
"src",
"base44/.types/*.d.ts"
]
}
```
If the path is already included, or no `tsconfig.json` exists, this step is silently skipped.
## When to Run
- After creating or modifying entity schemas in `base44/entities/`
- After adding or removing backend functions in `base44/functions/`
- After adding or removing agents in `base44/agents/`
- After adding or removing connectors in `base44/connectors/`
- When setting up a TypeScript project for the first time with Base44
## Notes
- The generated file should **not** be manually edited — it will be overwritten on the next run
- Consider adding `base44 types generate` to your build pipeline or as a pre-build script
- The `.types` directory is created automatically inside the `base44/` folder
SHA-256: 272c485008cbc0ed43f3c833defa206dadc95bcb489d6cd7ffd5a5296bd77786