Answer the question
In order to leave comments, you need to log in
Where to store reusable typescript interfaces?
I'm deploying a project to react. Where and how to store interfaces reused throughout the project? If you create an interfaces.d.ts file at the root of the project and put everything into it, is this legal? And create a directory models and throw in separate files there?
Answer the question
In order to leave comments, you need to log in
Illegally, d.ts files are for libraries written in js that need typings.
If the project is in typescript, then types and interfaces should be imported explicitly.
Either from models(interfaces, types, ...whatever), or from services that work with these types.
I'm leaning towards a modular structure, ie. interfaces are in a separate folder, next to the place where they are used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question