Currently, I am in the midst of a new project that involves a client
and a server
folder, each serving its designated purpose.
The client functions as a React application while the server comprises of Google Cloud functions operated by Express.
There are numerous shared types within the project, such as the User
interface. Presently, I have a duplicate user.ts
file within both application directories, which is less than optimal.
To simplify, here is a glimpse of the contents of the user.ts
file:
export default interface IUser {
id: string;
email: string;
uid: string;
username: string;
balance: number;
}
Is there a way to share these types across the entire project, perhaps without having to import them? I have come across suggestions about utilizing a d.ts
file, but it appears to be a rather makeshift solution?