googleapis / googleapis/google-cloud-node
[Firestore] `where` should use a "type safe" approach
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
You can currently use any string in the where clause of firestore. When using with converter the fieldPath should be "string safe"
Current implementation:
```ts
where(
fieldPath: string | FieldPath,
opStr: WhereFilterOp,
value: any
): Query;
```
Proposed implementation (when using with converter) :
```ts
where(
fieldPath: Path,
opStr: WhereFilterOp,
value: any
): Query;
```
where Path:
```ts
// Allows dot separated properties of
// for firebase updates
export type UpdatePath =
K extends string
? T[K] extends Record
? T[K] extends ArrayLike
? K | `${K}.${UpdatePath>}`
: K | `${K}.${UpdatePath}`
: K
: never;
export type Path = UpdatePath | keyof T;
```
Contributor guide
Assessment
This issue has not been assessed yet.