Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

84
Views
¿Declarar tipos para mi módulo TypeScript personalizado?

Estoy jugando con los módulos en mi proyecto de reacción mecanografiado. Tratando de ponerlos a trabajar. Declaré mi función asíncrona en mi archivo .ts con tipos como aquí:

 //Library Imports //Firestore SDK import { getFirestore, collection, getDocs, setDoc, doc, addDoc, getDoc, } from "firebase/firestore/lite"; //Firestore Config module import { fireApp } from "./FirestoreConfig"; const fireData = getFirestore(fireApp); //Get all documents from collection const getAllDocs = async (Collection: string): Promise<any[]> => { let baseQuery = await getDocs(collection(fireData, Collection)); let docs: any[] = []; baseQuery.forEach((doc) => docs.push(doc.data())); return docs; }; export { getAllDocs };

Luego importo "getAllDocs" en mi react app.tsx y recibo el error ingrese la descripción de la imagen aquí

Entonces, estoy tratando de usar un archivo d.ts para definir el tipo de mi función, y no puedo hacer que funcione. mi archivo d.ts se ve así. Esto no soluciona el problema.

 declare module "getAllDocs" { export default function getAllDocs(Collection: string): Promise<any[]>; }

¿Cómo escribo correctamente la función para eliminar el error? No quiero ignorar el error. El archivo d.ts está exactamente en el mismo directorio que el módulo que intento exportar. Cualquier ayuda sería muy apreciada.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!