Skip to content

Releases: tylim88/FirelordJS

2.8.18

25 Apr 02:27
Compare
Choose a tag to compare

Firelord React Native

  1. fixed some field values being exported as object instead of function

Firelord Admin

  1. simplify internal field values type

Firelord Web

  1. no changes

2.8.15

15 Apr 21:54
Compare
Choose a tag to compare

remove document path trailing slash, it used to be 'a/b/c/d/', now it is 'a/b/c'

2.8.7

24 Mar 17:29
Compare
Choose a tag to compare

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

23 Mar 18:53
Compare
Choose a tag to compare

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

23 Mar 18:33
Compare
Choose a tag to compare
  1. export ArrayUnionOrRemove type

  2. fix discriminated union value is inferred as never in where 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

12 Mar 07:57
Compare
Choose a tag to compare

solved where clause unable to get all keys of object unions type

2.8.0

09 Mar 13:22
Compare
Choose a tag to compare

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

14 Nov 21:04
Compare
Choose a tag to compare

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

19 Oct 11:27
Compare
Choose a tag to compare

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)

image

2.6.29 fixed these issues

2.6.28

18 Oct 12:23
Compare
Choose a tag to compare

fix discriminated unions not working in update operations (result in false error)