{"library":"schema-dts","title":"Schema.org TypeScript Type Definitions","description":"schema-dts provides comprehensive TypeScript definitions for the Schema.org vocabulary, specifically designed for use with JSON-LD structured data. It aims to simplify the creation and validation of Schema.org markup by offering complete sets of discriminated type unions, enabling robust type-checking and IDE auto-completion. The package is currently at version 2.0.0 and frequently updates its typings to align with the latest Schema.org releases, such as v30, v28, v15, ensuring developers always have access to current definitions. A key differentiator is its strict type validation, which helps prevent common errors in JSON-LD implementation. Although hosted under the Google GitHub organization, the README clarifies it is not an officially supported Google product, but it is actively maintained.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install schema-dts"],"cli":null},"imports":["import type { Person } from 'schema-dts';","import type { WithContext } from 'schema-dts';","import type { Graph } from 'schema-dts';","import type { MergeLeafTypes, ProductLeaf, SoftwareApplicationLeaf } from 'schema-dts';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import type { Person, Organization, Thing, WithContext } from 'schema-dts';\n\n/**\n * Helper function to generate a JSON-LD script tag.\n * In a real-world app, you might use a templating engine or a UI framework component.\n */\nexport function generateJsonLdScript<T extends Thing>(json: WithContext<T>): string {\n  return `<script type=\"application/ld+json\">\\n${JSON.stringify(json, null, 2)}\\n</script>`;\n}\n\n// Define a person's structured data\nconst inventor: Person = {\n  '@type': 'Person',\n  name: 'Grace Hopper',\n  disambiguatingDescription: 'American computer scientist',\n  birthDate: '1906-12-09',\n  deathDate: '1992-01-01',\n  awards: [\n    'Presidential Medal of Freedom',\n    'National Medal of Technology and Innovation',\n    'IEEE Emanuel R. Piore Award'\n  ]\n};\n\n// Define an organization's structured data with context\nconst myOrganizationLd = generateJsonLdScript<Organization>({\n  '@context': 'https://schema.org',\n  '@type': 'Corporation',\n  name: 'Example Corp LLC',\n  url: 'https://www.example.com',\n  logo: 'https://www.example.com/logo.png'\n});\n\nconsole.log(myOrganizationLd);\n/* Expected output (prettified JSON):\n<script type=\"application/ld+json\">\n{\n  \"@context\": \"https://schema.org\",\n  \"@type\": \"Corporation\",\n  \"name\": \"Example Corp LLC\",\n  \"url\": \"https://www.example.com\",\n  \"logo\": \"https://www.example.com/logo.png\"\n}\n</script>\n*/","lang":"typescript","description":"Demonstrates defining Schema.org types like `Person` and `Organization` using `WithContext<T>` and then serializing them into a JSON-LD script tag for web embedding.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}