From c1cac333d889a27119e7d8968a5d39cd7fa88a43 Mon Sep 17 00:00:00 2001 From: Micah Godbolt Date: Thu, 14 Feb 2019 15:02:36 -0800 Subject: [PATCH] adding types to 7 --- step1-07/src/TodoApp.types.ts | 10 ++++++++++ step1-07/src/components/TodoFooter.tsx | 7 ++++++- step1-07/src/components/TodoHeader.tsx | 21 ++++++++++++--------- step1-07/src/components/TodoList.tsx | 11 +++++++++-- step1-07/src/components/TodoListItem.tsx | 8 +++++++- step2-01/src/components/TodoHeader.tsx | 2 +- 6 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 step1-07/src/TodoApp.types.ts diff --git a/step1-07/src/TodoApp.types.ts b/step1-07/src/TodoApp.types.ts new file mode 100644 index 0000000..eb5437e --- /dev/null +++ b/step1-07/src/TodoApp.types.ts @@ -0,0 +1,10 @@ +export type FilterTypes = 'all' | 'active' | 'completed'; + +export interface TodoItem { + label: string; + completed: boolean; +} + +export interface Todos { + [id: string]: TodoItem; +} diff --git a/step1-07/src/components/TodoFooter.tsx b/step1-07/src/components/TodoFooter.tsx index b36b788..29534a9 100644 --- a/step1-07/src/components/TodoFooter.tsx +++ b/step1-07/src/components/TodoFooter.tsx @@ -1,6 +1,11 @@ import React from 'react'; +import { Todos } from '../TodoApp.types'; +interface TodoFooterProps { + clear: () => void; + todos: Todos; +} -export const TodoFooter = (props: any) => { +export const TodoFooter = (props: TodoFooterProps) => { const itemCount = Object.keys(props.todos).filter(id => !props.todos[id].completed).length; return (