Untyped maps (AnyMap
/ object
)
An untyped map represents a JSON-like structure with a value that can either be a number
, a string
, a boolean
, a bigint
, a null
, an array or an object.
- TypeScript
- C++
- Swift
- Kotlin
interface Fetch extends HybridObject {
get(url: string): AnyMap
}
class HybridFetch: public HybridFetchSpec {
std::shared_ptr<AnyMap> get(const std::string& url);
}
class HybridFetch: HybridFetchSpec {
func get(url: String) -> AnyMapHolder
}
class HybridFetch: HybridFetchSpec() {
fun get(url: String): AnyMap
}
tip
While untyped maps are implemented efficiently, Nitro cannot sufficiently optimize the object as keys and value-types are not known in advance. If possible, avoid untyped maps and use strongly typed objects instead.