I'm diving into the world of Typescript and Deno, but I'm struggling to understand how interfaces scopes work.
Here's the structure of my application:
The first layer (App.ts) contains the core logic of my application. This layer can reference the second layer (API.ts).
The second layer (API.ts) serves as the entry point for communication with external APIs like Facebook, Stripe, and Google API.
The third layer consists of multiple .ts files, each handling a specific part of an API. For example, FB_page.ts manages interactions with the Facebook pages API, while STRP_Subscription.ts is responsible for handling subscriptions in the Stripe API.
My issue lies in managing numerous interfaces that define parameter types, errors, and responses for API calls. These interfaces need to be accessible across all layers of my application.
It would be ideal to place interfaces related to a particular API within the file handling that API. For instance, having Facebook page API interfaces inside FB_page.ts.
However, constantly importing these interfaces across different layers, like in App.ts, using
import {IPost, IPost_Error, IPost_Response} from '../lib/FB_page.ts';
is cumbersome.
I initially stored these interfaces in .d.ts files, but they don't seem to be globally available either. How can I make my interfaces accessible without the need for repetitive imports throughout my application?
Thank you for your guidance.