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 isimplements
clause, which means that you are using an interface. This pattern is obsolete and pollutes codebase;type
insteadinterface
. That's why TypeScript is for. Let's leaveinterface
just 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
I
as a prefix. But I agree with your reason why it's not a smart idea 💡.And as you said, let's leave the
interface
for a class, makes perfect sense. So that's making it much more clear when to use ainterface
or atype
.