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

261
Views
Importar archivo de texto con ts-node

Me gustaría importar un archivo de texto:

 import text from "./text.txt";

tengo un archivo con:

 declare module "*.txt" { const content: string; export default content; }

Sin embargo, ts-node se queja con:

 error TS2307: Cannot find module './text.txt' or its corresponding type declarations.

Tenga en cuenta que no puedo usar el módulo fs para leer el archivo ya que también estoy usando el mismo código para la interfaz web (donde el paquete resuelve la importación).

EDITAR

Tratando de usar la propuesta en la primera respuesta:

 import text from "./text.txt!text";

con

 declare module "*!text" { const content: string; export default content; }

me sale este error:

 Cannot find module './text.txt!text' from '...'
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

tiene que decirle a mecanografiado que su módulo será un tipo de cadena como ese: importar texto de "./text.txt!text";

over 4 years ago · Santiago Trujillo Report
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!