Primitive Types
IonPath provides a rich set of built-in types covering integers, floats, strings, dates, and special types. Each type has a fixed wire encoding and mappings to C# and TypeScript.
Integer Types
Signed and unsigned integers from 8-bit to 128-bit.
| Ion Type | C# | TypeScript | Size | Description |
|---|---|---|---|---|
| i1 | sbyte | number | 8 bits | Signed byte (-128 to 127) |
| i2 | short | number | 16 bits | Signed short |
| i4 | int | number | 32 bits | Signed integer |
| i8 | long | bigint | 64 bits | Signed long |
| i16 | Int128 | bigint | 128 bits | Signed 128-bit integer |
| u1 | byte | number | 8 bits | Unsigned byte (0 to 255) |
| u2 | ushort | number | 16 bits | Unsigned short |
| u4 | uint | number | 32 bits | Unsigned integer |
| u8 | ulong | bigint | 64 bits | Unsigned long |
| u16 | UInt128 | bigint | 128 bits | Unsigned 128-bit integer |
ℹ
The naming convention follows byte count: i4 = 4 bytes = 32 bits. u prefix means unsigned, i means signed.
Floating-Point Types
| Ion Type | C# | TypeScript | Size | Description |
|---|---|---|---|---|
| f2 | Half | number | 16 bits | IEEE 754 half precision |
| f4 | float | number | 32 bits | IEEE 754 single precision |
| f8 | double | number | 64 bits | IEEE 754 double precision |
Special Types
| Ion Type | C# | TypeScript | Description |
|---|---|---|---|
| void | void | void | No value — used for methods with no return |
| bool | bool | boolean | Boolean true/false |
| string | string | string | UTF-8 text |
| guid | Guid | string | 128-bit UUID |
| bigint | BigInteger | bigint | Arbitrary-precision integer |
| bytes | byte[] / IonBytes | Uint8Array | Raw binary data |
| uri | Uri | string | URI/URL |
Date & Time Types
| Ion Type | C# | TypeScript | Description |
|---|---|---|---|
| datetime | DateTime | Date | UTC date and time |
| dateonly | DateOnly | string | Date without time component |
| timeonly | TimeOnly | string | Time without date component |
| duration | TimeSpan | number | Time span / duration |
Generic Wrappers
These built-in generic types wrap other types:
Wrapper Description
Maybe<T> Optional value. Shorthand:
T?. Null on the wire when absent. Array<T> Variable-length sequence. Shorthand:
T[]. CBOR array encoding. Partial<T> Sparse update — only modified fields are serialized. Shorthand:
~T. Usage Example
msg UserProfile { id: u4; // unsigned 32-bit integer name: string; // UTF-8 text email: string?; // optional string (Maybe<string>) avatar: bytes?; // optional binary data score: f8; // double-precision float createdAt: datetime; // UTC timestamp tags: string[]; // array of strings largeId: u8; // 64-bit unsigned (bigint in TS) uniqueRef: guid; // 128-bit UUID }