Skip to content

2.3.2

Compare
Choose a tag to compare
@tylim88 tylim88 released this 12 Feb 22:36
· 332 commits to main since this release
  • fix incorrect error message when in or not-in comparators trigger error (error is correct but message is not)
  • Fix array const assertion (recursively)
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