Advanced Type Features
Aexol supports advanced type system features including array types, circular references, and multi-dimensional arrays for building complex data structures.
Array Types
Define arrays of any type using the [] notation. Arrays can be single-dimensional or multi-dimensional.
Single-Dimensional Arrays
type User {
id: string
name: string
email: string
tags: string[]
profileImages: string[]
}
type BlogPost {
id: string
title: string
authorId: string
tags: string[]
relatedPostIds: string[]
}
✨ Edit in StudioArrays of Custom Types
type Post {
id: string
title: string
content: string
comments: Comment[]
likes: string[]
}
type User {
id: string
name: string
posts: Post[]
}
✨ Edit in StudioMulti-Dimensional Arrays
type Matrix {
id: string
name: string
data: number[][] // 2D array (matrix)
labels: string[]
}
type Tensor {
id: string
values: number[][][] // 3D array
}
✨ Edit in StudioCircular References
Aexol supports circular references, allowing types to reference themselves or each other.
Self-Referencing Types
type TreeNode {
id: string
value: string
parent: TreeNode
children: TreeNode[]
}
type Category {
id: string
name: string
parentCategory: Category
subcategories: Category[]
}
✨ Edit in StudioMutual References
type User {
id: string
name: string
posts: Post[]
comments: Comment[]
}
type Post {
id: string
title: string
content: string
author: User
comments: Comment[]
}
type Comment {
id: string
text: string
author: User
post: Post
}
✨ Edit in StudioComplex Circular Relationships
type Organization {
id: string
name: string
departments: Department[]
employees: Employee[]
}
type Department {
id: string
name: string
organization: Organization
employees: Employee[]
manager: Employee
}
type Employee {
id: string
name: string
department: Department
organization: Organization
directReports: Employee[]
manager: Employee
}
✨ Edit in StudioCode Generation
Aexol generates type-safe code from your type definitions in TypeScript, Python, Rust, Go, and JavaScript. Arrays become language-native collections, circular references use forward declarations, and multi-dimensional arrays map to nested collections.
Use Studio or the Remote MCP endpoint to generate code from any Aexol spec.
Best Practices
Use Arrays for Collections
// ✓ Clear collection intent
type Playlist {
id: string
name: string
trackIds: string[]
}
✨ Edit in StudioModel Real Bidirectional Relationships
type Book {
id: string
title: string
author: Author
}
type Author {
id: string
name: string
books: Book[]
}
✨ Edit in StudioUse Multi-Dimensional Arrays for Structured Data
type Image {
id: string
pixels: number[][] // 2D pixel data
width: number
height: number
}
✨ Edit in StudioValidation
Aexol validates:
- ✓ Array syntax is correct (
[],[][], etc.) - ✓ Referenced types exist
- ✓ Circular references are valid
- ✓ No infinite recursion in required fields
See Also
- Language Reference — Full type syntax
- Workflows & Recipes — Workflow patterns