Skip to main content
When you work with Base44 in a TypeScript project, you can use dynamic types. Your entities, functions, agents, and connectors have corresponding TypeScript types that provide:
  • Autocomplete: Your IDE suggests available entities, fields, functions, agents, and connector integration types.
  • Type safety: Catch typos and invalid fields at compile time instead of runtime.
  • Documentation: Hover over types in your IDE to see field descriptions and types.

How it works

Base44 reads your backend configuration and creates a base44/.types/types.d.ts file that augments the SDK with types from your project. The types file includes:
  • Entity schemas with typed fields and CRUD operations
  • Function names for autocomplete
  • Agent names for autocomplete
  • Connector integration type names for autocomplete

Entity types

Dynamic types provide full type safety for all entity operations. Your entity fields, return types, and parameters are all strongly typed.
import type { EntityRecord } from "@base44/sdk";

type TaskRecord = EntityRecord["Task"];

// All fields are typed
const task = await base44.entities.Task.create({
  title: "Complete documentation",
  status: "in-progress",
  priority: "high",
});

// Return type includes both your fields and server fields
console.log(task.id); // Server field
console.log(task.created_date); // Server field
console.log(task.title); // Your field

// Get with full type safety
const retrieved = await base44.entities.Task.get(task.id);

// Update with type checking
await base44.entities.Task.update(task.id, {
  status: "completed",
});

Function types

Function names are typed for autocomplete when invoking functions:
// Autocomplete shows all available functions
const result = await base44.functions.invoke("calculateTotal", {
  items: ["item1", "item2"],
});
Function parameter types are not generated. Refer to your function implementation for expected parameters.

Agent types

Agent names are typed for autocomplete when working with conversations:
// Autocomplete shows all available agents
const conversation = await base44.agents.createConversation("SupportBot");

Connector types

Connector integration type names are typed for autocomplete when retrieving OAuth tokens:
// Autocomplete shows all available connector integration types
const googleToken = await base44.asServiceRole.connectors.getAccessToken(
  "googlecalendar"
);
The connectors module is only available in service role mode (backend environments).

Generate types

To generate or update your types file, run the types generate command:
base44 types generate
Re-run types generate whenever you modify entities, add functions, or change agents to keep types up to date.

See also

  • types generate: CLI command to generate types from your project
  • entities: SDK reference for working with entities
  • functions: SDK reference for invoking backend functions
  • agents: SDK reference for working with AI agents
  • connectors: SDK reference for managing OAuth tokens