This question is not a dupe of this one, despite the similarites in the title. I'm not asking about the differences but the implications of the differences. Also, I've considered the risk of being opinion-based and voided it by limiting to two viable options and specifying a set of conditions.
I asked a question and got a type based answer, which worked.
export type Configs = {
[key: string]: ButtonConfig | TextBoxConfig | CheckConfig;
}
When I applied that in my project, the IDE TSLint'ed a sugestion to apply interface based approach instead.
export interface Configs {
[key: string]: TextBoxConfig | ButtonConfig | CheckConfig;
}
Those are two fundamentally different approaches and I got curious as to which would be most appropriate and when, according to best practices. A set of blogs like this one offer comparison tables. However, I'm confused as to the implication of said differences. For instance: "allows the creation of the new name for a type" is hard to evaluare versus "provides the powerful way to define entities", from my point of view. It's like saying "this one is large" and "that one has bananas".
I've found blogs that contradict and correct other blogs and docs, too. There are questions on SO too but those I've found, list the deviations rather than elaborating on the implications thereof. All in all, it's unclear to me how to interpret the info base.
The original poster, @thorjacobsen, replied that in his team they went for type based because of semantical preference, which is a local reason, not guaranteed to be applicable in a general case.
Of what I gathered, I get a sense that (unless other requirements impose a choice), interface is preferred by teams coming from .NET (keywork familiarity) while type is preferred by team with JS experience (historial sentiment). NB, I'm speculating here.
Given that times change and the methodics adapts to the wind of time, I wonder which one (if any) of the two would be suggested in a general case as the best practice (or safest bet until more info emerges).