P粉1514660812023-07-25 20:42:31
在映射數組時,只需使用answerProps介面。
interface answerProps { state: string; answer: string; } const results: Array<string> = []; !isEmpty(answers) && answers.map((item: answerProps) => results.push(`${item.state} : ${item.answer}`));