I am an expert software engineer with over a decade experience in the Web development industry. My main focus is to develop front-end solutions with JavaScript, Angular or React technical stack.
As long time developer with TypeScript, I would suggest:
Interfaces do not need "I" prefix in TypeScript, because there is implements clause, which means that you are using an interface. This pattern is obsolete and pollutes codebase;
If you want make your object stricter, use type instead interface. That's why TypeScript is for. Let's leave interface just for classes. If your app is not written in OOP, none of interfaces should be in your codebase.
Lead Frontend/JavaScript Developer since 2009🔥 Writing about CSS, JavaScript, Typescript, Angular, Serverless functions,, and a lot more web-related topics.
As long time developer with TypeScript, I would suggest:
I" prefix in TypeScript, because there isimplementsclause, which means that you are using an interface. This pattern is obsolete and pollutes codebase;typeinsteadinterface. That's why TypeScript is for. Let's leaveinterfacejust for classes. If your app is not written in OOP, none of interfaces should be in your codebase.@mbarzda thanks for the extra details 🙏.
Many codebases I've worked with use the
Ias a prefix. But I agree with your reason why it's not a smart idea 💡.And as you said, let's leave the
interfacefor a class, makes perfect sense. So that's making it much more clear when to use ainterfaceor atype.