Estoy exportando controladores en un index.ts, ¿alguien sabe qué tipo uso cuando paso la app como parámetro en la línea 7?
import userController from "./userController.js" import getController from "./getController.js" import productController from "./productController.js" const exportArr = [userController, getController, productController] export default (app: any) => { exportArr.forEach(controller => controller(app)) }Asegúrese de instalar tipos express npm install @types/express y en su archivo .ts import {Application} from 'express'
Su código se vería así:
import { Application } from "express"; import userController from "./userController.js" import getController from "./getController.js" import productController from "./productController.js" const exportArr = [userController, getController, productController] export default (app: Application) => { exportArr.forEach(controller => controller(app)) }