@tracksale/interfaces
v2.20.11
Published
Tracksale interfaces
Readme
Interfaces
The interfaces are able to describe the structures we need to comunicate with our model and all redux modules, such as Store and reducers. They are basically a scheme of how an object should look like.
A interface is composed by the necessary or possible fields of an object. Each field is from one type, such as boolean , number, string for example. To create our interface just follow the steps bellow:
Create a typescript file into src/cdk/interfaces with uour interface name ( For example: "Team.ts" )
Into this file, we will define our interface structure. The interface attributes are arranged in pairs of name and type as follows:
name:type. Here's an example fo how to code your interface:
// the '?' key before the attribute name tell for us tha this field is not required.
export interface Team {
id?: number;
name: string;
is_active?: boolean;
created_at?: number;
updated_at?: number;
}- After that, you will need to export your interface into the src/cdk/interfaces/index.ts. To do thi, just add an import for everything in your interface file, just like the example:
import * from './Team.ts';