simple-sifu / tutorial-typescript-redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tutorial-typescript-redux

Redux Architecture

Repo Diagram

Actions and Reducers

Actions and Reducers

In the upcoming lecture, we will be adding our searchRepositories action. You will likely see a TS error in the catch block that says Object is of type 'unknown'

There are two ways that you can resolve this for now:

Option #1

} catch (err: any) {

Option #2

...

} catch (err) {
  if (err instanceof Error) {
    dispatch({
      type: ActionType.SEARCH_REPOSITORIES_ERROR,
      payload: err.message,
    });
  }
}

...

About


Languages

Language:TypeScript 83.9%Language:HTML 16.1%