TypeScript definitions and generator for Schema.org vocabulary with strongly-typed JSON-LD support
—
Schema.org types for creative content including articles, books, websites, media, software applications, and other intellectual works.
The root type for all creative works and intellectual content.
/**
* The most generic kind of creative work, including books, movies, photographs,
* software programs, etc.
*/
type CreativeWork = CreativeWorkLeaf | AmpStory | ArchiveComponent | Article |
Atlas | Blog | Book | Certification | Chapter | Claim | Clip | Code |
Collection | ComicStory | Comment | Conversation | Course |
CreativeWorkSeason | CreativeWorkSeries | DataCatalog | Dataset |
DefinedTermSet | Diet | DigitalDocument | Drawing |
EducationalOccupationalCredential | Episode | ExercisePlan | Game |
Guide | HowTo | HowToDirection | HowToSection | HowToStep | HowToTip |
HyperToc | HyperTocEntry | LearningResource | Legislation | Manuscript |
Map | MathSolver | MediaObject | MediaReviewItem | Menu | MenuSection |
Message | Movie | MusicComposition | MusicPlaylist | MusicRecording |
Painting | Photograph | Play | Poster | PublicationIssue |
PublicationVolume | Quotation | Review | Sculpture | Season |
SheetMusic | ShortStory | SoftwareApplication | SoftwareSourceCode |
SpecialAnnouncement | Statement | Thesis | TVSeason | TVSeries |
VisualArtwork | WebContent | WebPage | WebPageElement | WebSite;
interface CreativeWorkBase extends ThingBase {
/** The subject matter of the content */
about?: SchemaValue<Thing, "about">;
/** Indicates that the resource is compatible with the referenced accessibility feature */
accessibilityFeature?: SchemaValue<Text, "accessibilityFeature">;
/** The human sensory perceptual system or cognitive faculty through which a person may process or perceive information */
accessMode?: SchemaValue<Text, "accessMode">;
/** A list of single or combined accessModes that are sufficient to understand all the intellectual content of a resource */
accessModeSufficient?: SchemaValue<ItemList, "accessModeSufficient">;
/** The author of this content or rating */
author?: SchemaValue<Organization | Person, "author">;
/** An award won by or for this item */
award?: SchemaValue<Text, "award">;
/** Fictional person connected with a creative work */
character?: SchemaValue<Person, "character">;
/** A citation or reference to another creative work */
citation?: SchemaValue<CreativeWork | Text, "citation">;
/** Comments, typically from users */
comment?: SchemaValue<Comment, "comment">;
/** The location depicted or described in the content */
contentLocation?: SchemaValue<Place, "contentLocation">;
/** Official rating of a piece of content */
contentRating?: SchemaValue<Rating | Text, "contentRating">;
/** The location where the CreativeWork was created */
creativeWorkStatus?: SchemaValue<DefinedTerm | Text, "creativeWorkStatus">;
/** The creator/author of this CreativeWork */
creator?: SchemaValue<Organization | Person, "creator">;
/** Date of first broadcast/publication */
dateCreated?: SchemaValue<Date | DateTime, "dateCreated">;
/** The date on which the CreativeWork was most recently modified */
dateModified?: SchemaValue<Date | DateTime, "dateModified">;
/** Date of first broadcast/publication */
datePublished?: SchemaValue<Date | DateTime, "datePublished">;
/** A secondary contributor to the CreativeWork */
editor?: SchemaValue<Person, "editor">;
/** Media type typically expressed using a MIME format */
encodingFormat?: SchemaValue<Text | URL, "encodingFormat">;
/** A creative work that this work is an example/instance/realization/derivation of */
exampleOfWork?: SchemaValue<CreativeWork, "exampleOfWork">;
/** Date the content expires and is no longer useful or available */
expires?: SchemaValue<Date | DateTime, "expires">;
/** Genre of the creative work, broadcast channel or group */
genre?: SchemaValue<Text | URL, "genre">;
/** Headlines of the article */
headline?: SchemaValue<Text, "headline">;
/** The language of the content or performance */
inLanguage?: SchemaValue<Language | Text, "inLanguage">;
/** Keywords or tags used to describe this content */
keywords?: SchemaValue<DefinedTerm | Text | URL, "keywords">;
/** A license document that applies to this content */
license?: SchemaValue<CreativeWork | URL, "license">;
/** The location where the CreativeWork was created */
locationCreated?: SchemaValue<Place, "locationCreated">;
/** Indicates the primary entity described in some page or other CreativeWork */
mainEntity?: SchemaValue<Thing, "mainEntity">;
/** The publisher of the creative work */
publisher?: SchemaValue<Organization | Person, "publisher">;
/** Date/DateTime the CreativeWork was published */
publishingPrinciples?: SchemaValue<CreativeWork | URL, "publishingPrinciples">;
/** The textual content of this CreativeWork */
text?: SchemaValue<Text, "text">;
/** Thumbnail image for an image or video */
thumbnailUrl?: SchemaValue<URL, "thumbnailUrl">;
/** The typical expected age range for the intended audience */
typicalAgeRange?: SchemaValue<Text, "typicalAgeRange">;
/** The version of the CreativeWork embodied by a specified resource */
version?: SchemaValue<Number | Text, "version">;
}Written content and news articles with various specializations.
/**
* An article, such as a news article or piece of investigative report
*/
type Article = ArticleLeaf | AdvertiserContentArticle | NewsArticle | Report |
SatiricalArticle | ScholarlyArticle | SocialMediaPosting | TechArticle;
interface ArticleBase extends CreativeWorkBase {
/** The number of words in the text of the Article */
wordCount?: SchemaValue<Integer, "wordCount">;
/** Articles may belong to one or more 'sections' in a magazine or newspaper */
articleSection?: SchemaValue<Text, "articleSection">;
/** For an Article, typically a NewsArticle, the dateline */
dateline?: SchemaValue<Text, "dateline">;
}
/**
* A NewsArticle is an article whose content reports news, or provides background context and supporting materials for understanding the news
*/
type NewsArticle = NewsArticleLeaf | AnalysisNewsArticle | AskPublicNewsArticle |
BackgroundNewsArticle | OpinionNewsArticle | ReportageNewsArticle |
ReviewNewsArticle;
/**
* An Article whose content is primarily {@link https://schema.org/about about} a particular {@link https://schema.org/SoftwareApplication SoftwareApplication}, {@link https://schema.org/WebApplication WebApplication}, or {@link https://schema.org/MobileApplication MobileApplication}
*/
type TechArticle = TechArticleLeaf | APIReference;
/**
* Reference documentation for application programming interfaces (APIs)
*/
type APIReference = APIReferenceLeaf;
interface APIReferenceBase extends TechArticleBase {
/** Associated product/technology version. E.g., .NET Framework 4.5 */
assemblyVersion?: SchemaValue<Text, "assemblyVersion">;
/** Library file name, e.g., mscorlib.dll, system.web.dll */
executableLibraryName?: SchemaValue<Text, "executableLibraryName">;
/** Indicates whether API is managed or unmanaged */
programmingModel?: SchemaValue<Text, "programmingModel">;
/** Type of app development: phone, Metro style, desktop, XBox, etc. */
targetPlatform?: SchemaValue<Text, "targetPlatform">;
}Usage Examples:
import type { Article, NewsArticle, TechArticle, APIReference } from "schema-dts";
// Basic article
const blogPost: Article = {
"@type": "Article",
headline: "Understanding TypeScript Generics",
author: {
"@type": "Person",
name: "Jane Developer"
},
datePublished: "2024-01-15",
articleSection: "Programming",
wordCount: 1500,
text: "TypeScript generics provide a way to create reusable components...",
keywords: ["TypeScript", "Generics", "Programming"]
};
// News article
const newsStory: NewsArticle = {
"@type": "NewsArticle",
headline: "New Framework Released",
dateline: "San Francisco, CA",
author: {
"@type": "Person",
name: "Tech Reporter"
},
publisher: {
"@type": "Organization",
name: "Tech News Daily"
},
datePublished: "2024-01-20",
articleSection: "Technology"
};
// API documentation
const apiDoc: APIReference = {
"@type": "APIReference",
headline: "Array.prototype.map() Method",
about: {
"@type": "SoftwareApplication",
name: "JavaScript"
},
programmingModel: "JavaScript",
targetPlatform: "Web Browsers, Node.js"
};Types for web pages, websites, and web-specific content.
/**
* A web page. Every web page is implicitly assumed to be declared to be of type WebPage
*/
type WebPage = WebPageLeaf | AboutPage | CheckoutPage | CollectionPage |
ContactPage | FAQPage | ItemPage | MedicalWebPage | ProfilePage | QAPage |
RealEstateListing | SearchResultsPage;
interface WebPageBase extends CreativeWorkBase {
/** A set of links that can help a user understand and navigate a website */
breadcrumb?: SchemaValue<BreadcrumbList | Text, "breadcrumb">;
/** Date when this media object was uploaded to this site */
uploadDate?: SchemaValue<Date | DateTime, "uploadDate">;
/** One of the more significant URLs on the page */
significantLink?: SchemaValue<URL, "significantLink">;
/** One of the domain specialists reviewing this content */
reviewedBy?: SchemaValue<Organization | Person, "reviewedBy">;
/** The most significant URLs on the page */
mainContentOfPage?: SchemaValue<WebPageElement, "mainContentOfPage">;
/** Indicates if use of the media require a subscription */
requiresSubscription?: SchemaValue<Boolean | MediaSubscription, "requiresSubscription">;
/** A link related to this web page */
relatedLink?: SchemaValue<URL, "relatedLink">;
}
/**
* A WebSite is a set of related web pages and other items typically served from a single web domain
*/
type WebSite = WebSiteLeaf;
interface WebSiteBase extends CreativeWorkBase {
/** The entity that issues the credential */
issuer?: SchemaValue<Organization, "issuer">;
}Usage Examples:
import type { WebPage, WebSite, AboutPage } from "schema-dts";
// Company website
const website: WebSite = {
"@type": "WebSite",
name: "Acme Corp Website",
url: "https://acme.com",
publisher: {
"@type": "Organization",
name: "Acme Corporation"
},
inLanguage: "en-US"
};
// About page
const aboutPage: AboutPage = {
"@type": "AboutPage",
name: "About Us - Acme Corp",
url: "https://acme.com/about",
mainEntity: {
"@type": "Organization",
name: "Acme Corporation"
},
isPartOf: {
"@type": "WebSite",
name: "Acme Corp Website",
url: "https://acme.com"
},
breadcrumb: {
"@type": "BreadcrumbList",
itemListElement: [
{
"@type": "ListItem",
position: 1,
name: "Home",
item: "https://acme.com"
},
{
"@type": "ListItem",
position: 2,
name: "About",
item: "https://acme.com/about"
}
]
}
};Types for software applications, source code, and development tools.
/**
* A software application
*/
type SoftwareApplication = SoftwareApplicationLeaf | GameApplication |
MobileApplication | WebApplication;
interface SoftwareApplicationBase extends CreativeWorkBase {
/** Type of software application, e.g. 'Game, Multimedia' */
applicationCategory?: SchemaValue<Text | URL, "applicationCategory">;
/** Subcategory of the application, e.g. 'Arcade Game' */
applicationSubCategory?: SchemaValue<Text | URL, "applicationSubCategory">;
/** The name of the application suite to which the application belongs */
applicationSuite?: SchemaValue<Text, "applicationSuite">;
/** Device required to run the application */
availableOnDevice?: SchemaValue<Text, "availableOnDevice">;
/** Countries for which the application is not supported */
countriesNotSupported?: SchemaValue<Text, "countriesNotSupported">;
/** Countries for which the application is supported */
countriesSupported?: SchemaValue<Text, "countriesSupported">;
/** Device required to run the application */
device?: SchemaValue<Text, "device">;
/** URL at which the app may be downloaded */
downloadUrl?: SchemaValue<URL, "downloadUrl">;
/** Features or modules provided by this application */
featureList?: SchemaValue<Text | URL, "featureList">;
/** Size of the application / package */
fileSize?: SchemaValue<Text, "fileSize">;
/** URL at which the app may be installed */
installUrl?: SchemaValue<URL, "installUrl">;
/** Minimum memory requirements */
memoryRequirements?: SchemaValue<Text | URL, "memoryRequirements">;
/** Operating systems supported */
operatingSystem?: SchemaValue<Text, "operatingSystem">;
/** Permission(s) required to run the app */
permissions?: SchemaValue<Text, "permissions">;
/** Processor architecture required to run the application */
processorRequirements?: SchemaValue<Text, "processorRequirements">;
/** Description of what changed in this version */
releaseNotes?: SchemaValue<Text | URL, "releaseNotes">;
/** Component dependency requirements for application */
requirements?: SchemaValue<Text | URL, "requirements">;
/** A link to a screenshot image of the app */
screenshot?: SchemaValue<ImageObject | URL, "screenshot">;
/** Version of the software instance */
softwareVersion?: SchemaValue<Text, "softwareVersion">;
/** Storage requirements (free space required) */
storageRequirements?: SchemaValue<Text | URL, "storageRequirements">;
/** Supporting data for a SoftwareApplication */
supportingData?: SchemaValue<DataFeed, "supportingData">;
}
/**
* Computer programming source code. Example: Full (compile ready) solutions, code snippet samples, scripts, templates
*/
type SoftwareSourceCode = SoftwareSourceCodeLeaf;
interface SoftwareSourceCodeBase extends CreativeWorkBase {
/** Link to the repository where the un-compiled, human readable code and related code is located */
codeRepository?: SchemaValue<URL, "codeRepository">;
/** The computer programming language */
programmingLanguage?: SchemaValue<ComputerLanguage | Text, "programmingLanguage">;
/** Runtime platform or script interpreter dependencies */
runtimePlatform?: SchemaValue<Text, "runtimePlatform">;
/** What type of code sample: full (compile ready) solution, code snippet, inline code, scripts, template */
codeSampleType?: SchemaValue<Text, "codeSampleType">;
/** Target Operating System / Product to which the code applies */
targetProduct?: SchemaValue<SoftwareApplication, "targetProduct">;
}Usage Examples:
import type { SoftwareApplication, SoftwareSourceCode, WebApplication } from "schema-dts";
// Software application
const textEditor: SoftwareApplication = {
"@type": "SoftwareApplication",
name: "CodeEdit Pro",
applicationCategory: "DeveloperApplication",
operatingSystem: ["Windows", "macOS", "Linux"],
softwareVersion: "2.1.0",
downloadUrl: "https://example.com/download",
fileSize: "45MB",
requirements: [
"4GB RAM minimum",
"500MB free disk space"
],
featureList: [
"Syntax highlighting",
"Auto-completion",
"Git integration"
]
};
// Source code repository
const codeProject: SoftwareSourceCode = {
"@type": "SoftwareSourceCode",
name: "React Todo App",
programmingLanguage: "JavaScript",
codeRepository: "https://github.com/user/react-todo",
runtimePlatform: "Node.js",
codeSampleType: "full solution",
targetProduct: {
"@type": "WebApplication",
name: "Todo List Manager"
},
author: {
"@type": "Person",
name: "Developer Name"
}
};Types for images, videos, audio, and other media content.
/**
* A media object, such as an image, video, or audio object embedded in a web page or a downloadable dataset
*/
type MediaObject = MediaObjectLeaf | _3DModel | AudioObject | DataDownload |
ImageObject | LegislationObject | MusicVideoObject | VideoObject;
interface MediaObjectBase extends CreativeWorkBase {
/** A URL pointing to a player for a specific video */
embedUrl?: SchemaValue<URL, "embedUrl">;
/** Player type required—for example, Flash or Silverlight */
playerType?: SchemaValue<Text, "playerType">;
/** The production company or studio responsible for the item */
productionCompany?: SchemaValue<Organization, "productionCompany">;
/** Date when this media object was uploaded to this site */
uploadDate?: SchemaValue<Date | DateTime, "uploadDate">;
/** The width of the item */
width?: SchemaValue<Distance | QuantitativeValue, "width">;
/** The height of the item */
height?: SchemaValue<Distance | QuantitativeValue, "height">;
/** The duration of the item */
duration?: SchemaValue<Duration, "duration">;
/** A URL where a copy of the MediaObject can be found */
contentUrl?: SchemaValue<URL, "contentUrl">;
/** File size in MB */
contentSize?: SchemaValue<Text, "contentSize">;
/** Bitrate used to encode the media object, in bits per second */
bitrate?: SchemaValue<Text, "bitrate">;
}
/**
* An image file
*/
type ImageObject = ImageObjectLeaf | Barcode | ImageObjectSnapshot;
/**
* A video file
*/
type VideoObject = VideoObjectLeaf | VideoObjectSnapshot;
/**
* An audio file
*/
type AudioObject = AudioObjectLeaf | AudioObjectSnapshot;Usage Examples:
import type { ImageObject, VideoObject, AudioObject } from "schema-dts";
// Image with metadata
const productImage: ImageObject = {
"@type": "ImageObject",
contentUrl: "https://example.com/product.jpg",
width: {
"@type": "QuantitativeValue",
value: 800
},
height: {
"@type": "QuantitativeValue",
value: 600
},
encodingFormat: "image/jpeg",
contentSize: "250KB",
name: "Product Photo",
caption: "High-quality product image"
};
// Video content
const tutorialVideo: VideoObject = {
"@type": "VideoObject",
name: "How to Use Our Software",
contentUrl: "https://example.com/tutorial.mp4",
embedUrl: "https://example.com/embed/tutorial",
duration: "PT10M30S", // 10 minutes 30 seconds
uploadDate: "2024-01-10",
encodingFormat: "video/mp4",
width: {
"@type": "QuantitativeValue",
value: 1920
},
height: {
"@type": "QuantitativeValue",
value: 1080
}
};Install with Tessl CLI
npx tessl i tessl/npm-schema-dts