Kyle Blue
Kyle Blue

Reputation: 311

What is the best practice to sharing types accross modules in Typescript?

I was wondering what the best practice is to sharing types accross modules in typescript. I initally thought it be a good idea to export types in a types file, and include this types file among other modules, though, I am not sure if there is another way. Thanks

Upvotes: 0

Views: 331

Answers (1)

Kokodoko
Kokodoko

Reputation: 28128

Your types are automatically shared between all files in a typescript project. You only need a ‘type definition’ file if you want to use an untyped javascript library. When working with modules you still need to use export and import of course.

Upvotes: 2

Related Questions