Let's have this piece of code written in TypeScript:
try {
// To call async functions, use redux-saga's `call()`.
const res = yield call(callApi, 'get', API_ENDPOINT, '/heroes')
if (res.error) {
yield put(fetchError(res.error))
} else {
yield put(fetchSuccess(res))
}
} catch (err) {
if (err instanceof Error) {
yield put(fetchError(err.stack!)) // <----------------------------??
} else {
yield put(fetchError('An unknown error occured.'))
}
}
What does err.stack!
in code mean? I am not familiar with this from JavaScript.