DEV Community

David Armendáriz
David Armendáriz

Posted on

Typescript interface file name conventions

Ok, so I have read out there that we shouldn't use the prefix I in our interfaces. I like the prefix I for my interfaces, but I can avoid using it if it is a "best practice". But what about file names? If you have a Foobar interface, what should be the name of the file? foobar.ts? foobar-interface.ts?

Top comments (2)

Collapse
 
stojakovic99 profile image
Nikola Stojaković

I typically put interfaces in an interfaces directory to make their function more obvious. You can also use Angular style naming (foobar.interface.ts).

Collapse
 
carlosaabud profile image
Carlos

foobar.model.ts

That’s usually what I see..