For every type used in your schema a TypeScript definition is automatically generated. They are all bundled in the Page namespace.
The example schema below:
alinea.schema({
BlogOverview: alinea.type('Blog overview', {
title: alinea.text('Title'),
path: alinea.path('Path')
}).configure({
isContainer: true,
contains: ['BlogPost']
}),
BlogPost: alinea.type('Blog post', {
title: alinea.text('Title'),
path: alinea.path('Path'),
publishDate: alinea.date('Publish date'),
body: alinea.richText('Body')
})
})
Will have the following types available:
import {Entry, TextDoc} from '@aline/core'
export namespace Page {
export interface BlogOverview extends Entry {
type: "BlogOverview"
title: string
path: string
}
export interface BlogPost extends Entry {
type: "BlogPost"
title: string
path: string
publishDate: string
body: TextDoc
}
}
export type Page =
| Page.BlogOverview
| Page.BlogPost
Which can be imported from the content package.
import {Page} from '@alinea/generated'