-
Notifications
You must be signed in to change notification settings - Fork 3
[Feature]: TS Type generation #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.28-pr.199.af7e13ePrefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.28-pr.199.af7e13e"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.28-pr.199.af7e13e"
}
}
Preview published to npm registry — try new features instantly! |
|
Posting inline comments on PR #199... |
Code reviewFound 1 issue that needs attention: Issue: Incorrect command in generated file commentsFiles affected:
Problem: However, the correct command is: Why this matters: Suggested fix: Review scope: Checked for bugs and CLAUDE.md compliance. |
|
Gap i see - the "Task" returned from the sdk doesn't not have the predefined fields like "is_sample", "id", "created_by".... |
Note
Description
This PR adds a new
base44 types generatecommand that generates TypeScript declaration files for Base44 projects. The command reads entities, functions, and agents from the project configuration and creates a type-safebase44/.types/types.d.tsfile with interfaces for entity schemas and registries for all resources. This enables autocomplete and type safety when using the @base44/sdk in TypeScript projects, improving developer experience with IDE support for project-specific schemas.Related Issue
Depends on base44/javascript-sdk#117
Type of Change
Changes Made
Core Type Generation Module (
src/core/types/)generator.ts: Converts entity JSON schemas to TypeScript interfaces usingjson-schema-to-typescript, handles nested objects, arrays, enums, and Base44-specific property typesupdate-project.ts: Automatically updatestsconfig.jsonto include generated types in theincludearrayEntityTypeRegistry,FunctionNameRegistry, andAgentNameRegistryCLI Command (
src/cli/commands/types/)typesparent command withgeneratesubcommand (currently hidden from help menu)-o, --outputflagDependencies & Configuration
json-schema-to-typescriptfor schema-to-interface conversioncommon-tagsfor clean template string formatting@types/json-schema,@types/common-tags)TYPES_OUTPUT_SUBDIRandTYPES_FILENAMEtosrc/core/consts.tsgetTypesOutputPath()helper tosrc/core/config.tsError Handling
TypeGenerationErrorto the error hierarchy insrc/core/errors.tsSchema Updates
binary,file,regex) from entity schemaTemplates & Testing
.gitignoretemplates to exclude generated.types/directorytests/cli/types_generate.spec.tswith-types-resourceswith entities, functions, and agentsCLITestkitwith test override support for app config mockingReliability Improvements
Documentation
AGENTS.mdwith complete architecture documentation for the types moduleTesting
bun test)Checklist
Additional Notes
Generated Output Structure:
The command generates a single declaration file that augments the
@base44/sdkmodule with project-specific types:user_profile→UserProfile)sdk.entity.create('user', ...))Command Usage:
base44 types generate # Generates base44/.types/types.d.ts + updates tsconfig.jsonModule Architecture:
The types command is currently hidden from the help menu while the feature undergoes final integration testing with the Base44 JavaScript SDK.
🤖 Generated by Claude | 2026-02-08 15:10 UTC