Skip to content

Overview

The CommonGrants.Types namespace contains types that are used throughout the protocol.

Types

Learn more about the base data types supported by the CommonGrants protocol:

String

TypeDescription
stringA sequence of characters
uuidA universally unique identifier
urlA Uniform Resource Locator (URL)

Numeric

TypeDescription
numericA number with an arbitrary precision and scale
integerA whole number without decimals
decimalStringA decimal number encoded as a string to preserve scale

Date and time

TypeDescription
isoTimeTime without timezone in ISO 8601 format (HH:mm:ss)
isoDateCalendar date in ISO 8601 format (YYYY-MM-DD)
utcDateTimeDatetime with UTC timezone in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)
offsetDateTimeDatetime with timezone in ISO 8601 format (YYYY-MM-DDThh:mm:ss±hh:mm)

Other types

TypeDescription
booleanA true or false value
arrayAn ordered list of values
recordA collection of key-value pairs
nullA null value
unknownA value of with any type

Usage

You can use the types listed above to define custom models in your TypeSpec project.

import "@common-grants/core"
// Exposes the `Types` namespace so that it can be accessed
// without a `CommonGrants` prefix
using CommonGrants;
model MyModel {
id: Types.uuid; // CommonGrants-defined type
description: string; // Standard TypeSpec type
tags: Array<string>; // A templated type
createdAt: utcDateTime;
}