Outline a set of types that will represent facts in the application.
Define classes for facts using the TypeScript Conventions.
Then write a function that adds those types to a
const blogModel = (b: ModelBuilder) => b .type(Site) .type(Post, m => m .predecessor("site", Site) ) ; const model = buildModel(b => b .with(blogModel) );
Pass a class to the
type method of the
type method returns the
ModelBuilder so that you can chain calls.
The second parameter is optional. If the fact class has no predecessors, then do not provide it.
If the fact class has predecessors, then provide a function that specifies them.
.type(Post, m => m .predecessor("site", Site) )
Compose type builder functions using the
Pass a function that adds types to a
buildModel to create a
Model from the
const model = buildModel(b => b .with(blogModel) );