JavaScript Mapping for Built-In Types

On this page:

Mapping of Slice Built-In Types to JavaScript and TypeScript Types

The Slice built-in types are mapped to JavaScript  and TypeScript types as follows:

Slice

JavaScript

TypeScript

bool

Boolean

boolean

byte

Number

number

short

Number

number

int

Number

number

long

Ice.Long

Ice.Long

float

Number

number

double

Number

number

string

String

string

Mapping of Slice built-in types to JavaScript.

JavaScript Mapping for Long Integers

JavaScript does not provide a type that is capable of fully representing a Slice long value (a 64-bit integer), therefore Ice provides the Ice.Long type. An instance of Ice.Long encapsulates the high and low order 32-bit words (in little endian format) representing the 64-bit long value and provides access to these values via the high and low properties. Instances also provide the toNumber method, which returns a Number if the long value can be correctly represented by the Number type's integer range, otherwise it returns Number.POSITIVE_INFINITY or Number.NEGATIVE_INFINITY for positive and negative values, respectively.

Ice.Long objects have limited functionality because their primary purpose is to allow a long value to be re-transmitted, but instances do support the methods hashCodeequals, and toString.

See Also