Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sanity/types

Package Overview
Dependencies
Maintainers
64
Versions
971
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/types

Type definitions for common Sanity data structures

  • 3.65.2-cops.39
  • cops
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
358K
increased by1.38%
Maintainers
64
Weekly downloads
 
Created

What is @sanity/types?

@sanity/types is a TypeScript library that provides type definitions for Sanity's content platform. It helps developers to define and work with the types of content schemas, documents, and other entities within the Sanity ecosystem.

What are @sanity/types's main functionalities?

Schema Type Definitions

This feature allows you to define the structure of your content types in a strongly-typed manner. The code sample demonstrates how to define a simple schema with a document type 'post' that has a 'title' field of type 'string'.

const schema: Schema = { name: 'mySchema', types: [{ name: 'post', type: 'document', fields: [{ name: 'title', type: 'string' }] }] };

Document Type Definitions

This feature provides type definitions for documents stored in Sanity. The code sample shows how to define a document of type 'post' with an ID and a title.

const post: SanityDocument = { _id: 'post1', _type: 'post', title: 'Hello World' };

Field Type Definitions

This feature allows you to define individual fields within your content types. The code sample demonstrates how to define a 'title' field of type 'string'.

const titleField: StringField = { name: 'title', type: 'string' };

Other packages similar to @sanity/types

Keywords

FAQs

Package last updated on 03 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc