Defining response types and column types
In this section, we will create TypeScript interfaces to define the data that we'll receive from the backend and create column definitions for the ProTable
component on each page.
Let's start with the interfaces. Follow these steps to create the TypeScript interfaces:
- Let's first create the folder for definition files. Under the
src
folder, create a new folder calledtypes
. - Now, in the
types
folder, create a new file nameduser.d.ts
and add the following interface code:export interface User { id?: number; name?: string; company?: string; role?: { id: number; title: string; }; isLoggedIn: boolean; }
The User
interface defines how we'll receive user information from the backend.
- Create a new file in the
types
folder namedcustomer.d.ts
and add the following interface:export interface...