Overview
Type generation automatically creates strongly-typed programming language interfaces from your SuprSend JSON schemas. Instead of manually writing type definitions, you define your workflow payload structure once as a JSON schema in SuprSend, and the CLI generates type-safe interfaces for TypeScript, Python, Go, Java, Kotlin, Swift, or Dart. This ensures payloads sent to workflows always match the expected schema, catching errors at compile time instead of at runtime.Generated type files are auto-generated and should not be manually edited. Regenerate types when you update schemas in SuprSend.
Why Use Type Generation?
Without type generation, you work with plain objects that can lead to runtime errors. Type generation catches these errors during development with compile-time type safety and IDE autocomplete.Generate Types
Prerequisites
Before generating types, ensure you have:- ✅ SuprSend CLI installed
- ✅ Authenticated with your workspace
- ✅ Created and enabled schemas for your workflows (see guide)
Command Syntax
Once you’ve completed all the prerequisites, you can generate types using the following command in CLI. It will create type definitions for all the live schemas in your workspace:Supported Languages
| Language | File Extension | Default Output File |
|---|---|---|
| TypeScript | .ts | suprsend-types.ts |
| Python | .py | suprsend-types.py |
| Go | .go | suprsend-types.go |
| Java | .java | suprsend-types.java |
| Kotlin | .kt | suprsend-types.kt |
| Swift | .swift | suprsend-types.swift |
| Dart | .dart | suprsend-types.dart |
Output File Structure
The output of the syntax generates a file with interfaces or definitions corresponding to all events and workflows that are linked to the schemas. So, there can’t be a mismatch between the schema mapped to the event or workflow while writing the code. All events are suffixed withEvent keyword and workflows are suffixed with Workflow keyword.
Use Generated Types
Once generated, you can import the type definitions in your workflow or event triggers to ensure type safety throughout your codebase.Best Practices
- Don’t edit generated files — treat them as build artifacts and regenerate from schema changes.
- Regenerate on schema updates — keep types in sync with SuprSend schemas (ideally in the same PR as schema changes).
- Automate in CI/CD — run type generation in your pipeline and fail the build if generated output is out of date.
- Version your schemas — evolve payloads safely without breaking existing producers/consumers.
- Use types at boundaries — type the payload right before calling
workflows.trigger(...)(and validate incoming webhook/event payloads).
Frequently Asked Questions
My generated types are outdated. What should I do?
My generated types are outdated. What should I do?
If generated types don’t match your current schemas, regenerate them using the CLI:Always regenerate types after updating or committing schemas in SuprSend.
Why are some fields missing in my generated types?
Why are some fields missing in my generated types?
This usually happens when:
- The schema is still in draft and not committed
- Types were not regenerated after schema changes
Why do I see type errors in my IDE but the code still runs?
Why do I see type errors in my IDE but the code still runs?
This typically means:
- Generated types are outdated
- The schema was changed in SuprSend but types weren’t regenerated
- You’re generating types from the wrong workspace
--workspace flag if used.What happens if I don’t use type safety?
What happens if I don’t use type safety?
Without type safety:
- Errors surface only at runtime
- Invalid payloads may partially process
- Workflow conditions and templates can break silently
- Debugging becomes harder across environments
Should I edit the generated type files?
Should I edit the generated type files?
No. Generated files should not be edited manually. Any changes will be overwritten the next time types are regenerated. Always update schemas in SuprSend and regenerate types.
How often should I regenerate types?
How often should I regenerate types?
You should regenerate types whenever:
- A schema is added or updated
- A field is added, removed, or renamed
- A field’s datatype changes
Can I automate type generation in CI/CD?
Can I automate type generation in CI/CD?
Yes. It’s recommended to add type generation to your CI/CD pipeline to ensure schemas and application code stay in sync across environments.
What does type safety mean in SuprSend workflows?
What does type safety mean in SuprSend workflows?
Type safety ensures that the data you send when triggering workflows or events strictly matches the schema defined in SuprSend. This helps catch missing fields, wrong data types, or invalid payloads during development instead of at runtime.
Why should I use type-safe workflow triggers?
Why should I use type-safe workflow triggers?
Type-safe triggers help prevent production bugs caused by incorrect payloads, improve developer experience with autocomplete and validation, and ensure your workflow logic always receives valid and expected data.
How does SuprSend generate type-safe interfaces?
How does SuprSend generate type-safe interfaces?
SuprSend generates strongly typed interfaces directly from your JSON schemas. You define the schema once in SuprSend, and the CLI generates language-specific types (TypeScript, Python, Go, Java, Kotlin, Swift, Dart) that stay in sync with your workflows.
Which languages are supported for type generation?
Which languages are supported for type generation?
SuprSend supports type generation for:
- TypeScript
- Python
- Go
- Java
- Kotlin
- Swift
- Dart
Related Documentation
- Validate Trigger Payload - Learn about JSON schemas and how to link them to workflows or events
- CLI Generate Types Reference - Complete CLI command reference for generating types