An open API service indexing awesome lists of open source software.

https://github.com/nwtgck/egghead-todo-typescript-react

Type-safe TODO list app in React + Redux + TypeScript
https://github.com/nwtgck/egghead-todo-typescript-react

egghead eggheadio react reactjs typescript

Last synced: 2 months ago
JSON representation

Type-safe TODO list app in React + Redux + TypeScript

Awesome Lists containing this project

README

          

# Type-safe TODO list app in TypeScript + React + Redux

A Type-safe TODO list application written in TypeScript following by the wonderful lessons of [egghead.io](https://egghead.io/).

## Awesome egghead.io Redux lessons!

This repository is TypeScript version of the lessons bellow.

https://egghead.io/courses/getting-started-with-redux

## Demo page

https://nwtgck.github.io/egghead-todo-typescript-react/build/

## How to run

```sh
$ cd
$ npm install
$ npm start
```

Then, go to http://localhost:8080.

## How to build .html file and bundle.js

```sh
$ cd
$ npm install
$ npm run build
```

Then, you can open `./build/index.html` by your browser.

## Main technologies

* TypeScript
* React
* Redux
* webpack

## Type safety

`Filter`, for example, is seems to be just string.
But only `'SHOW_ALL'`, `'SHOW_ACTIVE'` and `'SHOW_COMPLETED''` are acceptable as `Filter` because `Filter` type is defined bellow.

```ts
type Filter = 'SHOW_ALL' | 'SHOW_ACTIVE' | 'SHOW_COMPLETED';
```

Because of this feature, we can use string more relax without considering typo.

.tsx bellow is valid.

```tsx
All
```

But, the mistake bellow will be detected at compile time. Good!

```tsx
All
```

This is only just one example. Almost things are typed, and some human errors can be detected at compile time.