The project provides a comprehensive set of TypeScript typings based on the Schema vocabulary, enabling developers to author JSON-LD structured data with strong type safety. It supplies both high-level discriminated unions and helper types to model contexts, graphs, and linked data relationships with clarity and accuracy. Usage examples demonstrate how one can import types like Person, WithContext, or Graph and compose JSON-LD objects in a way that aligns with semantic-web and knowledge-graph practices. The repository also contains a generator tool that can pull ontology definitions and emit TypeScript definitions in bulk, ensuring the typings stay up to date and maintain consistency. It supports scenarios such as nested objects, graphs of entities, and action types with input/output constraints, which makes it suitable for rich metadata authoring and linked-data workflows. While it is maintained by Google, it is not an officially supported Google product.
Features
- Provides TypeScript typings for the complete Schema vocabulary in JSON-LD format
- Supports discriminated type unions for better IntelliSense and strict validation
- Includes WithContext and Graph utilities for structured data with @context and @graph
- Supports input/output constraints via WithActionConstraints for action annotations
- Offers a CLI generator (schema-dts-gen) to build custom typings from any Schema ontology
- Enables schema validation at compile time, reducing markup errors in structured data