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

175
Views
¿Es posible usar la definición de tipo sin importar?

Estoy escribiendo Thunderbird WebExtension. Quiero usar Parsimmon en él. Pero al importar el módulo, Thunderbird afirma

 Uncaught Error: Dynamic require of "parsimmon" is not supported

(Este mensaje se imprime si es require === undefined )

Así que decidí cargar umd.min.js a través de la etiqueta <script> en backgorund.html y options.html . Pero no sé cómo usar la definición de tipo.

Mi solución actual es escribir declare global {} y copiar y pegar parte de parsimmon.d.ts en él.

 export {} declare global { namespace Parsimmon { // ... } }

La finalización del código VSCode funciona bien con esta declaración.

 import P = Parsimmon; const integer: P.Parser<number> = P.regexp(/[0]|[1-9][0-9]*/).map(parseInt);

Pero quiero evitar copiar y pegar. ¿Hay alguna forma de utilizar node_modules/@types/parsimmon/index.d.ts directamente?

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!