question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deno - how to import with typings?

See original GitHub issue

Hi. Great library. I am trying to use it in Deno, but can’t seem to get typings to work… I am importing via

import {PDFDocument} from "https://cdn.pika.dev/pdf-lib@^1.7.0";

and everything works, but I don’t have types imported, so I don’t have intellisense in VS code.

When I import this library for node project (via npm ), everything is fine. Am I missing something? Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
zackdotcomputercommented, Oct 6, 2020

Did too much investigation here, full details in the other Issue but the TLDR is:

  • No longer have to downgrade to the deprecated plugin
  • Instead, have to add ?dts to the end of imports from skypack.dev (formerly pika.dev)

So import { PDFDocument } from 'https://cdn.skypack.dev/pdf-lib@^1.11.1?dts'; works

1reaction
bockoblurcommented, Jun 21, 2020

Follow-up

After some investigation, turns out that official VS Code plugin Deno by denoland is not working as it should. Reverting to VS Code plugin marked as deprecated [Deprecated] Deno by axetroy solved the issue.

Conclusion

There’s really no issue here with your library after all. Sorry to bother you and keep up the excellent work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Types and Type Declarations | Manual - Deno
So I have mod.js and mod.d.ts . If I try to import mod.js into Deno, it will only do what I ...
Read more >
How to pull typings in Deno - Stack Overflow
Create a typings/ folder. Run deno --types > typings/deno.d.ts . Deno would output a type definition file for the core API. Now the ......
Read more >
How we converted our Node.js library to Deno (using Deno)
Writing a Deno-ifier​ · Rewrite the Node.js-style imports to the more explicit style Deno. · Swapping out all imports from adapter.node to adapter ......
Read more >
Create your first module with Deno - Livio Brunner
js. TypeScript import error with Deno. The vscode-deno extension fixes these kinds of remote imports by caching the typings in a special directory....
Read more >
Deno 1.17 Release Notes
Deno 1.17 adds JSON imports, import completions in the REPL, and much more.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found