[FR] Public API to Detect FieldValue.increment()
@ehsannas is already working on this.
Since Aug 12, 2025.
Assessment
This issue has not been assessed yet.
Description
The Firebase Admin Node SDK currently does not provide a public API to detect if a value is a FieldValue.increment() object. This forces developers to rely on internal implementation details like checking for constructor.name === 'NumericIncrementTransform', which is fragile and may break with SDK updates.
Current Workaround
// Current approach relies on internal implementation
function hasFieldValueIncrement(value: unknown): boolean {
return (
typeof value === 'object' &&
value.constructor &&
value.constructor.name === 'NumericIncrementTransform'
);
}
Problem
- Fragility: The
NumericIncrementTransformclass name is an internal implementation detail - No Stability Guarantee: This approach may break in future SDK versions
- Lack of Documentation: No official way to detect increment operations
Requested Enhancement
Please provide a public API method to detect FieldValue.increment() objects, similar to how other Firebase features provide type guards.
Suggested API
import { FieldValue } from 'firebase-admin/firestore';
// Option 1: Static method on FieldValue
FieldValue.isIncrement(value: unknown): value is FieldValue
// Option 2: Dedicated type guard function
import { isIncrement } from 'firebase-admin/firestore';
isIncrement(value: unknown): value is FieldValue
Use Case
This is needed for:
- Data validation pipelines that need to identify increment operations
- Custom diffing systems that handle FieldValue operations differently
- Development tools that analyze Firestore update patterns
- Testing utilities that need to verify increment operations
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 419
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from firebase/firebase-admin-node
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comments · 1 assignee ·
-
api: messaging
Difficulty 3/5 1-2 days Newbie friendliness 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Difficulty 5/5 Over a week Newbie friendliness 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comment · 1 assignee ·
All issues in firebase/firebase-admin-node
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
mksglu/context-mode#1200 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/claude-code#96687 ·
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
AOSSIE-Org/DebateAI#582 · 2 comments ·