Reputation: 53850
I have this example in JS:
export function* mySaga () {
yield takeEvery('USER_FETCH_REQUESTED', fetchUser);
}
Can I rewrite it as an arrow function in TypeScript, something like this below?
export const mySaga* = () {
yield takeEvery('USER_FETCH_REQUESTED', fetchUser);
}
Upvotes: 0
Views: 695
Reputation: 1074555
Remember that TypeScript tries, mostly, to be JavaScript-plus-types (but early-adopting newer features). There is no arrow form of a generator function. However, Brendan Eich and Domenic Denicola are supposed to be working on one.
(The TypeScript specificaton just has a placeholder for its Generator Functions section [that link will rot as it's to a section number], and neither the issue related to implementing generators in TypeScript nor a related pull request mentions an arrow form.)
Upvotes: 5