Typescript file-naming conventions

Viewed 17062

I'm looking for the Typescript file-naming conventions, specifically for a file which stores only types and interfaces.

Now, I've found a couple of Typescript Coding Convention projects on GitHub, and they even refer to file-naming conventions here and here. But none of them refers to the specific file that I'm interested in, namely - a file which stores only types and interfaces.

For all it matters, within my project this file serves for both internal usage and external API.

2 Answers

Sometimes I get tired of spending time researching for things like this so I have decided to go with the following practice.

interfaces folder for files that contain interfaces
file naming convention: file.interface.ts

types folder for files that contain types
file naming convention: file.type.ts

we usually go for "index.d.ts" and have multiple spaced throughout the project.

Related