It is an array of objects. either you need a object or you will have to find the index within that array. like conversationMetaData[index].name
conversationMetaData is an array. So it's obvious it doesn't have name attribute. You have to access the corresponding element in the array like below.
conversationMetaData[id].name;
TS doesnt know what type of object you are intending to return unless you provide a type . You can use interfaces for this purpose
eg:
createObject: SomeType = () => {
// Your function returning object of 'SomeType'
}
export interface Sometype {
name: string,
age: number
// etc..
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.