react-native-nitro-modules 0.31.4 → 0.31.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -187,3 +187,19 @@ class Promise<T> {
187
187
  }
188
188
  }
189
189
  }
190
+
191
+ /**
192
+ * Resolves this `Promise<Unit>`.
193
+ * @since void overload
194
+ */
195
+ fun Promise<Unit>.resolve() {
196
+ resolve(Unit)
197
+ }
198
+
199
+ /**
200
+ * Create an already resolved `Promise<Unit>`.
201
+ * @since void overload
202
+ */
203
+ fun Promise.Companion.resolved(): Promise<Unit> {
204
+ return Promise.resolved(Unit)
205
+ }
@@ -9,7 +9,7 @@
9
9
  #define NitroDefines_h
10
10
 
11
11
  // Sets the version of the native Nitro core library
12
- #define NITRO_VERSION "0.31.4"
12
+ #define NITRO_VERSION "0.31.5"
13
13
 
14
14
  // Sets whether to use debug or optimized production build flags
15
15
  #ifdef DEBUG
@@ -108,6 +108,7 @@ extension Promise {
108
108
  /**
109
109
  * Create a new `Promise<T>` that runs the given `run` function on a parallel Thread/`DispatchQueue`.
110
110
  */
111
+ @preconcurrency
111
112
  public static func parallel(
112
113
  _ queue: DispatchQueue = .global(),
113
114
  _ run: @escaping @Sendable () throws -> T
@@ -125,6 +126,22 @@ extension Promise {
125
126
  }
126
127
  }
127
128
 
129
+ /// Void overloads to avoid typing out `()`
130
+ extension Promise where T == Void {
131
+ /**
132
+ * Resolves this `Promise<Void>`.
133
+ */
134
+ public func resolve() {
135
+ return self.resolve(withResult: ())
136
+ }
137
+ /**
138
+ * Create an already resolved `Promise<Void>`.
139
+ */
140
+ public static func resolved() -> Promise {
141
+ return Self.resolved(withResult: ())
142
+ }
143
+ }
144
+
128
145
  /// Extensions to support then/catch syntax.
129
146
  extension Promise {
130
147
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-nitro-modules",
3
- "version": "0.31.4",
3
+ "version": "0.31.5",
4
4
  "description": "Insanely fast native C++, Swift or Kotlin modules with a statically compiled binding layer to JSI.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",