-
Notifications
You must be signed in to change notification settings - Fork 648
Open
Labels
api: firestoreIssues related to the Firestore API.Issues related to the Firestore API.library: nodejs-firestoreIssues transferred from another repositoryIssues transferred from another repositorypriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
I have some code which was working great with earlier versions of firestore/typescript, but after updating can't see how firestore expects nested objects to be updated with dynamic paths.
It happily accepts a single string literal like this:
// no type error
const keyPath = "paymentHistory.test";
t.update(userRef, {
[keyPath]: payment,
});But strangely this results in a complex type error involving AddPrefixToKeys.
// type error
const keyPath = "paymentHistory." + "test";
t.update(userRef, {
[keyPath]: payment,
});The paymentHistory property on the User object is defined like this:
paymentHistory: Record<string, Payment>I am using package versions:
"firebase-admin": "11.10.1",
"firebase-functions": "4.4.1",
"typescript": "5.2.2"
How can I satisfy the types, when the nested key "test" is a variable and not known at build time?
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: firestoreIssues related to the Firestore API.Issues related to the Firestore API.library: nodejs-firestoreIssues transferred from another repositoryIssues transferred from another repositorypriority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.