All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.apollographql.apollo3.api.apolloUnsafeCast.kt Maven / Gradle / Ivy

There is a newer version: 4.0.0-beta.7
Show newest version
package com.apollographql.apollo3.api

import com.apollographql.apollo3.annotations.ApolloExperimental

/**
 * Uses [unsafeCast] on JS or a regular `as` unsafe cast on other platforms.
 *
 * On JS targets [apolloUnsafeCast] bypasses the Kotlin type system. If the target class or interface is missing some fields, the cast will succeed but an exception will be thrown later when accessing the missing field.
 *
 * On non-JS targets, [apolloUnsafeCast] uses the Kotlin type system and will throw an exception if the receiver is not of the expected type.
 */
@ApolloExperimental
expect inline fun   Any.apolloUnsafeCast(): T

inline fun  Any.defaultApolloUnsafeCast(): T {
  return this as T
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy