You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey y'all
Im working with updating multiple records using sobject.update
For some reason the typing result is RecordResult instead of a RecordResult array even tho the actual response is an array.
I have confirmed that the call is hitting the updateMany function stored on connection.
Versions :
JSForce Version: 1.11
api version: .42
node version: 16.l19.1
the call is successful however I'm not able to loop through the array of results because typescript thinks that it is a singular RecordResult
please let me know if you have any insight
Actual Behavior
type of result whether in callback or async await is type RecordResult so i am unable to loop through results without using @ts-ignore
Expected Behavior
Result to be typed as RecordResult[] to allow me to loop through RecordResults to search for errors
code example
const records = [{Id: ...}, {Id: ...}, {Id: ...}]
const result = await connection.sobject('type').update(records)
console.log(result) <-- this is type RecordResult not RecordResult[]
console.log(result[0]) <-- Element implicitly has an 'any' type because expression of type '0' can't be used to index type 'RecordResult'.
Property '0' does not exist on type 'RecordResult'
ALTERNATE
const records = [{Id: ...}, {Id: ...}, {Id: ...}]
connection.sobject('Type').update(records).then( (err, result) => {
if (err) {
console.error(err)
}
console.log(result[0]) Same issue as above
})
.catch(err => console.error(err))
The text was updated successfully, but these errors were encountered:
Hey y'all
Im working with updating multiple records using sobject.update
For some reason the typing result is RecordResult instead of a RecordResult array even tho the actual response is an array.
I have confirmed that the call is hitting the updateMany function stored on connection.
Versions :
the call is successful however I'm not able to loop through the array of results because typescript thinks that it is a singular RecordResult
please let me know if you have any insight
Actual Behavior
Expected Behavior
code example
ALTERNATE
The text was updated successfully, but these errors were encountered: