commonMain.com.apollographql.apollo3.api.apolloUnsafeCast.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apollo-api-jvm Show documentation
Show all versions of apollo-api-jvm Show documentation
Apollo GraphQL API classes
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