This commit is contained in:
lightling 2024-03-13 01:23:57 -04:00
parent 86b6c6ba89
commit 397380ca39

39
src/content-env.d.ts vendored
View file

@ -1,25 +1,54 @@
declare module 'content/routes.js' {
/**
* Defines the available `views` that can be used to set up routes.
* Each `Template` has different configuration options
*/
type Template =
| 'markdown'
type GenericRouteDefinition = {
/**
* Defines the shared options for a route
*/
type SharedRouteDefinition = {
id: string
stylesheetUrls: string[]
template: Template
}
type MarkdownDefinition = GenericRouteDefinition & {
template: 'markdown'
/**
* Defines a content-based route
*/
type ContentfulRouteDefintion = SharedRouteDefinition & {
content: string
}
/**
* Defines the config for a route using the `markdown` {@link Template}
*/
type MarkdownDefinition = ContentfulRouteDefintion & {
template: 'markdown'
}
/**
* Defines all available route definitions
*/
type RouteDefinition =
| MarkdownDefinition
/**
* Defines the collection of routes the app uses
*/
type RouteCollection = { [key: string]: RouteDefinition }
/**
* The routes the app uses
*/
const routes: RouteCollection
/**
* Defines an entry in the app header.
* Optionally recursive by defining children instead of path.
*/
type HeaderEntry = {
displayName: string
} & ({
@ -28,5 +57,9 @@ declare module 'content/routes.js' {
children: HeaderEntry[]
})
/**
* The header the app uses.
* If not present, the header will not show.
*/
const header: HeaderEntry[]
}