Skip to content

Releases: tylim88/FirelordJS

2.6.27

13 Oct 18:35
Compare
Choose a tag to compare

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

12 Oct 15:21
Compare
Choose a tag to compare

fix update operation missing autocomplete if the data is an empty object

2.6.20

08 Oct 07:37
Compare
Choose a tag to compare

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

02 Oct 10:08
Compare
Choose a tag to compare
  1. 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)
  1. 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

image

  1. 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

  1. transaction and batch operation refs no longer return undefined (trivial)

2.6.15

20 Sep 13:47
Compare
Choose a tag to compare

fix updateDoc does not error on nested unknown key

example, given this type {a: { b:2 } }

updateDoc(ref, {a: { c:2 }}) // will not error, it is wrongly expecting {c?: unknown}, this is a false positive

2.6.15 fixed this issue

this is a very old bug

2.6.13

19 Sep 17:53
Compare
Choose a tag to compare

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

01 Sep 10:04
Compare
Choose a tag to compare

expand json type, example

old:
image

new:
image

2.6.8

03 Aug 14:13
Compare
Choose a tag to compare

rename Serial types to JSON types for easier understanding https://firelordjs.com/highlights/transformative_types/#json-types

image

2.6.7

02 Aug 15:23
Compare
Choose a tag to compare

Introduce serial types

image

2.6.6

01 Aug 08:57
Compare
Choose a tag to compare
  1. 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
  2. some housekeeping