SWE
SWE

Reputation: 485

TypeScript global modules declaration

I'm developing a NodeJS API using TypeScript. I have several .ts file and in all of them I'm importing external modules again and again (e.g. soap, xmlParser, url, underscore, etc.).

Is there any convenient way to declare them somehow globally and use them without import them in each .ts file?

Thanks,

Upvotes: 1

Views: 836

Answers (1)

basarat
basarat

Reputation: 276209

Is there any convenient way to declare them somehow globally and use them without import them in each .ts file?

Have a file utils.ts and just export these from them. Now you only need to import utils.

Upvotes: 1

Related Questions