Avoiding Direct Database Import in `functions.ts`
When you manage your project without using layers or a content management system in "effect," and you import a database instance directly into
The database instance becomes a dependency as soon as you run the app because of this import in
i wish there will be something to import type of db insted of db itself
oh i think we should do like this
functions.ts like this: import db from 'drizzle, it establishes a database connection during the import process itself. Consequently, if you reference functions.ts in another file, such as test.ts, to log something or use a function, it inadvertently triggers a connection to the database because the database instance is already imported in functions.ts. This happens even if the purpose of using functions.ts in test.ts is merely to access non-database-related functionalities.The database instance becomes a dependency as soon as you run the app because of this import in
functions.ts. However, there's an issue with managing the TypeScript typings for the database. The database has various functionalities, and without importing these typings, you can't easily determine the data types it handles. So the question is, how can we include all the necessary TypeScript typings for the database as a dependency?i wish there will be something to import type of db insted of db itself
oh i think we should do like this
