As I am making a nextjs app I kept type related to frontend to close the frontend folders and for backend, I was putting them to close to the backend.
Such as at frontend I am putting type inside @/app/(code)/constants/ISnippet
and backend core>domain>entities>Snippet.ts
For this reason, there are duplicate types how to handle this properly?
Example
@/app/(code)/constants/ISnippet
export interface SnippetViews {
count: number;
snippetId: string;
}
export interface ISnippet {
id: string;
title: string;
code: string;
language: string;
theme: string;
fontFamily: string;
fontSize: string;
lineNumbers: boolean;
padding: string;
customColors: string[];
colorMode: string;
angle: number;
grain: boolean;
createdAt: Date;
updatedAt: Date;
userId: string;
views: SnippetViews;
}
core>domain>entities>Snippet.ts
export interface Snippet {
id: string;
title?: string;
code?: string;
language: string;
theme: string;
fontFamily: string;
fontSize: string;
lineNumbers: boolean;
padding: string;
customColors?: object;
colorMode: string;
angle: number;
grain: boolean;
createdAt: Date;
updatedAt: Date;
userId: string;
}