Core TypeScript type definitions for SE Studio content models
npm install @se-studio/core-data-typesCore TypeScript type definitions for SE Studio content models and shared types across the monorepo.
``bashpnpm
pnpm add @se-studio/core-data-types
Usage
`typescript
import type { IPage, ISeoMetadata, IAsset, DeepPartial } from '@se-studio/core-data-types';// Use the page interface
const page: IPage = {
id: 'page-123',
slug: 'about-us',
title: 'About Us',
seo: {
title: 'About Us - SE Studio',
description: 'Learn more about SE Studio',
},
};
// Use utility types
type PartialPage = DeepPartial;
`API Reference
$3
#### Pages
-
IBasePage - Base interface for page content models
- Extends IBaseModel with page-specific properties
- type: 'Page' - Content type discriminator
- isHomePage: boolean - Whether this is the home page
- contents?: ReadonlyArray - Page content sections
- tags?: ReadonlyArray - Tags associated with the page
- structuredData?: ReadonlyArray - Optional structured data-
PageLink - Page link type (metadata without full content)#### Articles
-
IBaseArticle - Base interface for article content models
- type: 'Article' - Content type discriminator
- articleType?: IInternalLink - Link to the article type
- contents?: ReadonlyArray - Article content sections
- tags?: ReadonlyArray - Tags associated with the article-
IBaseArticleType - Base interface for article type content models
- type: 'Article type' - Content type discriminator
- indexPageContent?: ReadonlyArray - Content for index page
- searchPageContent?: ReadonlyArray - Content for search page#### Components & Collections
-
IBaseComponent - Base interface for component content models
- IBaseCollection - Base interface for collection content models
- IBaseExternalComponent - Base interface for external component models#### Visual/Asset Types
-
IVisual - Union type for visual content (Image | Video | Animation)
- IImage - Image types (Picture | SvgImage | SvgData)
- IVideo - Video content type
- IAnimation - Animation/Lottie content type
- IResponsiveVisual - Responsive visual with breakpoint configuration#### Link Types
-
ILinkProps - Base link properties
- IInternalLink - Internal link to CMS content
- IExternalLink - External link
- IDownloadLink - Download link
- IBlankLink - Blank link (no href)#### Context Types
-
IPageContext - Page context with links to related content
- IContentContext - Content context for component rendering
- IAnalyticsContext - Analytics context for tracking$3
-
isPage(content) - Check if content is a page
- isArticle(content) - Check if content is an article
- isArticleType(content) - Check if content is an article type
- isComponent(content) - Check if content is a component
- isCollection(content) - Check if content is a collection
- isInternalLink(link) - Check if link is internal
- isExternalLink(link) - Check if link is external
- isDownloadLink(link) - Check if link is a download link
- isImage(visual) - Check if visual is an image
- isVideo(visual) - Check if visual is a video
- isAnimation(visual) - Check if visual is an animation$3
-
DeepPartial - Makes all nested properties optional (recursive)
- Prettify - Improves type readability in IDE tooltipsFor detailed JSDoc documentation on all types and functions, see the TypeScript declaration files (
.d.ts) in the package.Development
This package is part of the SE Studio monorepo. To work on this package:
`bash
Install dependencies
pnpm installBuild the package
pnpm buildRun tests
pnpm testType check
pnpm type-checkRun linting
pnpm lint
`Extending Types
These types serve as a foundation and should be extended based on your actual Contentful content model:
`typescript
import type { IPage } from '@se-studio/core-data-types';// Extend the base page type with your custom fields
interface ICustomPage extends IPage {
hero: {
title: string;
image: IAsset;
};
content: RichTextContent;
}
``This package currently contains placeholder types. As the content model evolves, additional types will be added for:
- Component types (Hero, CTA, etc.)
- Rich text content structures
- Navigation structures
- Blog/Article types
- And more...
MIT