December 2017
Beginner
372 pages
10h 32m
English
The todo.ts file contains a couple of classes—todo and todolist—and has an interface ITodo.
We have a Todo class, which has three properties: name, description, and completed. The Todo class implements an interface ITodo:
interface ITodo{ name:string; description: string; completed: boolean;}
Implementing an interface helps maintain code consistency; in large applications, if any class implements an interface, that would act as a contract between the class which implements the interface and the class/module which creates an object of this class. An interface provides code abstraction and helps us create more manageable code. As we discussed earlier, an interface is just a TypeScript concept and, upon compilation, no JavaScript code ...
Read now
Unlock full access