JavaScript types
SoliboClient handles most Kotlin-to-JavaScript conversions. Use this guide for the differences that matter when reading responses or passing inputs.
Layers.
sdk.apiis the facade: it takes one named-parameter object and returns decoded, frozen JavaScript values.sdk.rawis the generated Kotlin client, with positionalbigintarguments and response wrappers, for status codes, headers and downloads.
Quick reference
| Value | sdk.api inputs | Results |
|---|---|---|
| Collections | Plain arrays | Frozen arrays (copy before changing; see Calling conventions) |
| Maps | JS Map or object | Read-only JS Map |
IDs (Long) | number, string, or bigint | bigint |
Byte arrays (ByteArray) | Int8Array | Int8Array |
Instant | ISO timestamp string | ISO timestamp string |
LocalDate | YYYY-MM-DD string | YYYY-MM-DD string |
| Enums | SDK constant or documented string value | Enum object with .name and .value |
Byte arrays are Int8Array, not Uint8Array: new Int8Array(await file.arrayBuffer()).
Prefer the facade
// sdk from Getting started
const page = await sdk.api.task.indexTasks({ companyId })
const titles = page.items.map(task => task.title)
Use sdk.raw when you need raw response envelopes or other APIs unavailable through sdk.api. Raw conversion helpers come from @solibo/solibo-sdk/interop.
1. Paged lists — PagedList<T>
Paged endpoints return items, meta, and paging. See Paged lists for walking the pages and for the React hooks.
2. Collections — KtList / KtMap
No collection helpers are needed anywhere. The package converts at its boundary: pass plain arrays, Maps, or plain objects to sdk.api, to raw sdk.raw.api.* methods, to model constructors, and to setters, and receive plain arrays and Maps from getters, body(), headers, callbacks, and helper methods. A model you construct reads back as JS, and a model you received can be passed back as it is. KtList.fromJsArray(values) and KtMap.fromJsMap(map) from @solibo/solibo-sdk/interop remain available for backwards compatibility; a Kotlin collection passed in is accepted unchanged.
3. Long — API parameters
Response IDs are bigint. Use .toString() for display, URL parameters, or keys. Only convert to number when the ID is within JavaScript’s safe integer range. Raw KMP calls require bigint IDs; sdk.api also accepts strings and numbers.
Serialization (handled automatically)
Importing @solibo/solibo-query (or @solibo/solibo-react, which imports it) defines BigInt.prototype.toJSON, returning a string, for the whole app if it is not already defined. For SDK-only applications, provide that conversion when serializing results yourself.
4. Date and time — Instant and LocalDate
Pass new Date().toISOString() for timestamps and a YYYY-MM-DD string for calendar dates. Do not pass a JavaScript Date object directly. Convert a returned timestamp with new Date(value) when needed for display.
Raw KMP helpers include createInstant(date) and createLocalDate(year, month, day) from @solibo/solibo-sdk/interop.
5. Enums
Compare a returned enum with its SDK constant, or read .name or .value:
import { ExpenseStatus } from '@solibo/solibo-sdk'
const approved = expense.status === ExpenseStatus.APPROVED
const statusText = expense.status.value
An enum object is not equal to a plain string with ===. Enums expose both SectionType.BOLIG and SectionType.Bolig, and inputs also accept the wire string. These docs use the upper-case form, which matches Kotlin and the wire.
6. Sealed classes / polymorphic types
For resident results, use the type discriminator to distinguish variants:
if (resident.type === 'solibo.residents.query.domain.PersonResident') {
console.log(resident.email)
}
type values such as solibo.residents.query.domain.PersonResident look like class names, but they are stable wire identifiers. Compare against the exported ResidentDiscriminator type, and give every switch a default branch: new values appear without a version change.
7. null vs undefined
Nullable fields can be null; omitted fields can be undefined. Use value ?? fallback to handle both. When you need to tell them apart, see Field projections.