Socket
Socket
Sign inDemoInstall

@sanity/types

Package Overview
Dependencies
Maintainers
48
Versions
851
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/types


Version published
Weekly downloads
222K
decreased by-2.83%
Maintainers
48
Created
Weekly downloads
 

Package description

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

Last updated on 16 Apr 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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc