Content Delivery API > Custom Scalar Types

Custom Scalar Types

The API references a number of custom GraphQL Scalar Types. If you're using code generators to transform GraphQL types coming from the Content Delivery API to TypeScript, here's the list of mappings you need to specify:

BooleanType: boolean
CustomData: Record<string, string>
Date: string
DateTime: string
FloatType: number
IntType: number
ItemId: string
JsonField: unknown
MetaTagAttributes: Record<string, string>
UploadId: string
Pro tip: How To Generate TypeScript Types From GraphQL

Generating TypeScript types from GraphQL queries improves code security, consistency, and robustness by avoiding manual type definitions. This tutorial explains how to set up graphql-codegen to automatically generate TypeScript types for a Next.js project using DatoCMS.