Releases: tylim88/FirelordJS
2.6.27
set
operation throw false type error when working with mapped type where the key
type is string
example meta type
type A = MetatypeCreator<{
a: Record<string, number>
},'id'>
this will throw type error even though it should be correct
const b:string = "zzz"
setDoc(ref, { a: { [b]: "yyy" } })
this is because keyof type { [x: string]: unknown }
is string | number
while keyof Record<string, number>
is string
2.6.27 fixed this issue
2.6.23
2.6.20
add toTimestamp
to convert JSONTimeStamp to Firestore Timestamp:
import { toTimestamp } from 'firelordjs'
const firestoreTimestamp = toTimestamp(someJSONTimestamp)
https://firelordjs.com/highlights/transformative_types#json-types
2.6.17
- allow
updateDocNoFlatten
to receive empty object as argument on nested level
updateDocNoFlatten(docRef, { } ) // this will still throw type error and runtime error. With runtime error there is one exception: transaction update(web only), this inconsistency come from firebase Web SDK.
updateDocNoFlatten(docRef, { a: { } } ) // this will no longer throw type error. It will delete all members of object 'a' (default behavior of firestore update operation)
- previously by design the library sacrificed autocomplete for smarter type checking in update operations. Now autocomplete is possible in all update operations without sacrificing smarter type checking
- fixed:
The type of dynamic object key is not working properly if the type is mapped type, e.g.
updateDoc(ref, { a:{ [b]:1 } })
where the type is{ a:Record<string,number> }
.
{ a:{ [b]: 1 } }
now work fine
- transaction and batch operation refs no longer return undefined (trivial)
2.6.15
2.6.13
fix updateDoc object literal types are not optional if union with non-object literal type
example, given this type {a: false | {b:2, c:3} }
updateDoc(ref, {a: { b:2 }}) // will error, it is wrongly expecting {b:2, c:3}, this is a false error
2.6.13 fixed this issue
2.6.12
2.6.8
rename Serial types to JSON types for easier understanding https://firelordjs.com/highlights/transformative_types/#json-types
2.6.7
Introduce serial types
2.6.6
- all onSnapshot callback return types now are
void | Promise<void>
because popular eslint rule no-misused-promises throw error if you try to use async callback - some housekeeping