Skip to content

Commit e6d8487

Browse files
committed
fix FieldPath constructor in JS
1 parent 6edd737 commit e6d8487

File tree

2 files changed

+4
-3
lines changed
  • firebase-common/src/jsMain/kotlin/dev/gitlive/firebase
  • firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore

2 files changed

+4
-3
lines changed

firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ external object firebase {
182182
fun clearPersistence(): Promise<Unit>
183183
}
184184

185-
open class FieldPath constructor(fieldNames: Array<out String>)
185+
open class FieldPath constructor(vararg fieldNames: String)
186186

187187
open class Query {
188188
fun get(options: Any? = definedExternally): Promise<QuerySnapshot>

firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ actual class DocumentSnapshot(val js: firebase.firestore.DocumentSnapshot) {
342342

343343
actual typealias FieldPath = Any
344344

345-
actual fun FieldPath(vararg fieldNames: String): FieldPath = rethrow { firebase.firestore.FieldPath(fieldNames) }
346-
345+
actual fun FieldPath(vararg fieldNames: String): FieldPath = rethrow {
346+
js("Reflect").construct(firebase.firestore.asDynamic().FieldPath, fieldNames).unsafeCast<FieldPath>()
347+
}
347348

348349
actual object FieldValue {
349350
actual fun delete(): Any = rethrow { firebase.firestore.FieldValue.delete() }

0 commit comments

Comments
 (0)