Releases: tylim88/FirelordJS
2.8.18
2.8.15
2.8.7
fix nested object in mapped type is not partial in update
type DU = MetaTypeCreator<Record<string, { k: Record<`${1 | 2 | 3}`, number> }>, 'abc'>
const du = getFirelord<DU>(getFirestore(), 'abc')
const docRef = du.doc('123')
updateDoc(docRef, { x: { k: { '1': 1 } } }) // unexpected error requires all properties to present, now is fixed
2.8.6
fix value of where
clause top level field from discriminated unions being never
import {
MetaTypeCreator,
query,
where,
} from 'firelordjs'
type DU = MetaTypeCreator<
{ c: false } | { c: true; v: 0 },
'abc'
>
const du = getFirelord<DU>(getFirestore(), 'abc')
query(du.collection(), where('v', '==', 0)) //should be ok but error
2.8.5
-
export
ArrayUnionOrRemove
type -
fix discriminated union value is inferred as
never
inwhere
clause
import {
MetaTypeCreator,
query,
where,
} from 'firelordjs'
type DU = MetaTypeCreator<
{ a: { b: 1; c: 2 } | { b: 'a'; d: 'b' } },
'abc'
>
const du = getFirelord<DU>(getFirestore(), 'abc')
query(du.collection(), where('a.b', '==', 2)) // previously no error but is expected to error
2.8.2
2.8.0
now require typescript 5.4.2 and above
also please change your vscode TS version to 5.4.2, guide: https://firelordjs.com/change_ts_version
2.7.0
no longer support full flattened path if the key is string
given this type:
{
a: Record<string,{ b: number, c: { d: string } }>
}
previously firelord generates the flattened path that look like:
{
a: Record<string,{ b: number, c: { d: string } }>
[x : `a.${string}`]: { b: number, c: { d: string } }
[x : `a.${string}.b`]: number
[x : `a.${string}.c`]: { d: string }
[x : `a.${string}.c.d`]: string
}
the problem is: a.${string}.b
, a.${string}.c
and a.${string}.c.d
will collapsed into a.${string}
to address this issue, firelord now generates:
{
a: Record<string, { b: number, c: { d: string }, `c.d`: string }>
}
firelord will not attempt to flatten mapped type, but will still continue to flatten any nested object literal type, in this case it is the c.d
affected operation: all update operations
Remove JSON type
JSON type is now available by accessing meta type instead: Example['readJSON']
2.6.29
solved discriminated union not working correctly when using it with ternary
type DU = MetaTypeCreator<
| { a: { b: 1; c: 2 } | { b: 'a'; d: 'b' } }
| { x: { y: 1; z: 2; u: 3 } | { y: 'a'; w: 'b'; v: 'c' } | false },
'abc'
>
const du = getFirelord<DU>(getFirestore(), 'abc')
const docRef = du.doc('123')
const v = false as boolean
const x = v
? {
y: 1 as const,
}
: {
w: 'b' as const,
}
// ok as expected
updateDoc(docRef, {
x,
})
// should be ok but error
// this error is unrelated to const assertion because of const modifier on type parameters
updateDoc(docRef, {
x: v
? {
y: 1,
z: 2,
}
: {
w: 'b',
v: 'c',
},
})
const data = {
x: v
? {
y: 1,
z: 2,
u: 3,
}
: {
y: 'a',
w: 'b',
v: 'c',
},
}
// should be error because no const assertion but ok
updateDoc(docRef, data)
2.6.29 fixed these issues