Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Remove a bunch of deprecated APIs
  • Loading branch information
mrousavy committed Mar 4, 2026
commit 189be6c2f4e6c7074cacbb483821ff983c3c3765
9 changes: 0 additions & 9 deletions packages/nitrogen/src/syntax/kotlin/KotlinVariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ data class ${innerName}(@DoNotStrip val value: ${bridge.getTypeCode('kotlin')}):
})

const packageName = NitroConfig.current.getAndroidPackage('java/kotlin')
const getterCases = variant.cases.map(([label]) => {
const innerName = capitalizeName(label)
return `is ${innerName} -> value as? T`
})
const isFunctions = variant.cases.map(([label]) => {
const innerName = capitalizeName(label)
return `
Expand Down Expand Up @@ -94,11 +90,6 @@ ${extraImports.join('\n')}
sealed class ${kotlinName} {
${indent(innerClasses.join('\n'), ' ')}

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
${indent(getterCases.join('\n'), ' ')}
}

${indent(isFunctions.join('\n'), ' ')}

${indent(asFunctions.join('\n'), ' ')}
Expand Down
1 change: 0 additions & 1 deletion packages/react-native-nitro-modules/NitroModules.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Pod::Spec.new do |s|
"ios/core/ArrayBufferHolder.hpp",
"ios/core/PromiseHolder.hpp",
"ios/utils/AnyMapUtils.hpp",
"ios/utils/AnyMapHolder.hpp", # <-- deprecated, removed soon
"ios/utils/Result.hpp",
"ios/utils/DateToChronoDate.hpp",
"ios/utils/RuntimeError.hpp",
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native-nitro-modules/ios/core/AnyMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,3 @@ extension AnyMap {
return dictionary
}
}

@available(*, deprecated, renamed: "AnyMap")
public typealias AnyMapHolder = AnyMap
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import Foundation
/// See `data`, `size` and `isOwner`.
public typealias ArrayBuffer = margelo.nitro.ArrayBufferHolder

@available(*, deprecated, renamed: "ArrayBuffer")
public typealias ArrayBufferHolder = ArrayBuffer

// pragma MARK: Wrap

extension ArrayBuffer {
Expand Down
13 changes: 0 additions & 13 deletions packages/react-native-nitro-modules/ios/utils/AnyMapHolder.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions packages/react-native-nitro-modules/ios/utils/AnyMapUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ namespace margelo::nitro {

using SharedAnyMap = std::shared_ptr<AnyMap>;

// TODO: Remove TSharedMap.
/// @deprecated
using TSharedMap = SharedAnyMap;

namespace AnyMapUtils {

inline AnyValue create_AnyValue(NullType null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ sealed class CoreTypesVariant {
@DoNotStrip
data class Sixth(@DoNotStrip val value: AnyMap): CoreTypesVariant()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
is Third -> value as? T
is Fourth -> value as? T
is Fifth -> value as? T
is Sixth -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class NamedVariant {
@DoNotStrip
data class Second(@DoNotStrip val value: Car): NamedVariant()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class StringOrExternal {
@DoNotStrip
data class Second(@DoNotStrip val value: String): StringOrExternal()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_Boolean_Double {
@DoNotStrip
data class Second(@DoNotStrip val value: Double): Variant_Boolean_Double()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,6 @@ sealed class Variant_Boolean_DoubleArray_Array_String__String_Double {
@DoNotStrip
data class Fifth(@DoNotStrip val value: Double): Variant_Boolean_DoubleArray_Array_String__String_Double()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
is Third -> value as? T
is Fourth -> value as? T
is Fifth -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_Boolean_OldEnum {
@DoNotStrip
data class Second(@DoNotStrip val value: OldEnum): Variant_Boolean_OldEnum()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_Boolean_WeirdNumbersEnum {
@DoNotStrip
data class Second(@DoNotStrip val value: WeirdNumbersEnum): Variant_Boolean_WeirdNumbersEnum()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_Car_Person {
@DoNotStrip
data class Second(@DoNotStrip val value: Person): Variant_Car_Person()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_HybridBaseSpec_OptionalWrapper {
@DoNotStrip
data class Second(@DoNotStrip val value: OptionalWrapper): Variant_HybridBaseSpec_OptionalWrapper()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_HybridTestObjectSwiftKotlinSpec_Person {
@DoNotStrip
data class Second(@DoNotStrip val value: Person): Variant_HybridTestObjectSwiftKotlinSpec_Person()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_NullType_String {
@DoNotStrip
data class Second(@DoNotStrip val value: String): Variant_NullType_String()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_String_Double {
@DoNotStrip
data class Second(@DoNotStrip val value: Double): Variant_String_Double()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ sealed class Variant_______Unit_Double {
@DoNotStrip
data class Second(@DoNotStrip val value: Double): Variant_______Unit_Double()

@Deprecated("getAs() is not type-safe. Use fold/asFirstOrNull/asSecondOrNull instead.", level = DeprecationLevel.ERROR)
inline fun <reified T> getAs(): T? = when (this) {
is First -> value as? T
is Second -> value as? T
}

val isFirst: Boolean
get() = this is First
val isSecond: Boolean
Expand Down
Loading