Open ghost opened 5 years ago
Data that isn't coming from some external API but is created within the code itself, should not use interfaces but real classes.
Example:
interface ISearchData { title?: string; note?: string; primaryNumber?: string; secondaryNumber?: string; textRecognitionEnabled?: boolean; isInGroup?: boolean; dateFrom?: Date; dateTo?: Date; tags?: Array<string>; }
When we switch to creating a real class for the object, the object itself can manage its status... For example the primary and secondary number can never be negative, or the order of dateFrom and dateTo needs to be consistent.
dateFrom
dateTo
Data that isn't coming from some external API but is created within the code itself, should not use interfaces but real classes.
Example:
When we switch to creating a real class for the object, the object itself can manage its status... For example the primary and secondary number can never be negative, or the order of
dateFrom
anddateTo
needs to be consistent.