report error
Cannot read properties of undefined (reading 'forEach')
reason
forEach
The object used is not Array
of type, it is recommended to check the code.
Solution
Validate before executing the program, or use the default value syntax.
function arr(data: any[] = []) {
data.forEach((e) => {
...
})
}