TypeScript

The type of a content Type can be inferred.

import alinea from 'alinea'

const schema = alinea.schema({
  BlogOverview: alinea.document('Blog overview', {
    [alinea.meta]: {
      isContainer: true,
      contains: ['BlogPost']
    }
  }),
  BlogPost: alinea.document('Blog post', {
    publishDate: alinea.date('Publish date'),
    body: alinea.richText('Body')
  })
})

type BlogOverview = alinea.infer<typeof schema.BlogOverview>
type BlogPost = alinea.infer<typeof schema.BlogPost>