import {
MetaTypeCreator,
getFirelord,
query,
where,
getFirestore,
} from 'firelordjs'
const fs = getFirestore()
type ABC = MetaTypeCreator<
{
a: 1 | 2 | 3 // literal type
b: ('a' | 'b' | 'c')[] // literal array type
},
'ABC'
>
const ColRef = getFirelord<ABC>(db, 'ABC').collection()
// literal type
query(ColRef, where('a', '>', 1)) // ok, not dealing with array
query(ColRef, where('a', 'in', [1])) // not ok, it is an array AND literal type, need const assertion!
query(ColRef, where('a', 'in', [1 as const])) // ok, const assertion!
query(ColRef, where('a', 'in', [1] as const)) // error before v2.3.2, now it is fixed
// literal array type
query(ColRef, where('b', '==', ['a'])) // not ok, dealing with array AND literal type, need const assertion!
query(ColRef, where('b', '==', ['a' as const])) // ok, const assertion!
query(ColRef, where('b', 'in', [['a' as const]])) // ok, const assertion!
query(ColRef, where('b', '==', ['a'] as const)) // // error before v2.3.2, now it is fixed
query(ColRef, where('b', 'in', [['a'] as const])) // error before v2.3.2, now it is fixed
query(ColRef, where('b', 'in', [['a']] as const)) // error before v2.3.2, now it is fixed