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.

Remove the unofficial TypeScript definitions from DefinitelyTyped

See original GitHub issue

Currently there’s unofficial, likely unmaintained, and out-of-date TypeScript definitions published via https://github.com/DefinitelyTyped/DefinitelyTyped for the pdfjs-dist library; see https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/pdfjs-dist

Now that we, from version 2.6.347, are shipping official TypeScript definitions through https://github.com/mozilla/pdfjs-dist, it’d be a good idea to submit a PR to DefinitelyTyped to remove its TypeScript definitions; see https://github.com/DefinitelyTyped/DefinitelyTyped#removing-a-package

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

8reactions
tamuratakcommented, Sep 19, 2020

For PDF.js v2.6.347, you can import them with the following:

import type {PDFDocumentProxy, PDFPageProxy} from 'pdfjs-dist/types/display/api'
8reactions
billyjanitschcommented, Sep 18, 2020

The official TS definitions bundled in 2.6.347, while much appreciated, only include bindings for the top-level API and therefore lack many of the useful types currently exposed by the DefinitelyTyped definitions, such as:

  • PDFPageProxy
  • PDFDocumentProxy
  • PDFRenderTask
  • PDFDocumentLoadingTask

It’s possible to access these types through the official definitions by using complex sequences of type operations, e.g.:

type PDFDocumentProxyPromise = ReturnType<typeof getDocument>['promise']
type PDFDocumentProxy = PDFDocumentProxyPromise extends Promise<infer U> ? U : never

However, this is inconvenient and also unconventional within the TypeScript ecosystem. Type definitions for libraries usually export typings for important objects/classes (without exporting their values).

Would you consider exposing these types in the official type definitions before removing the typings from DefinitelyTyped?

Read more comments on GitHub >

github_iconTop Results From Across the Web

@types/find-remove - npm
TypeScript definitions for find-remove. ... Start using @types/find-remove in your project by running `npm i @types/find-remove`.
Read more >
How to replace @types/jest with @jest/globals and jest-mock
I believe that it's always better to prefer official type definitions rather than unofficial DefinitelyTyped. And Jest v27 introduced new ...
Read more >
tsd - How do I remove typescript definition? - Stack Overflow
Running tsd reinstall --clean will eliminate the definitions not found in tsd.json . Please note that tsd is deprecated.
Read more >
How to add type definitions to a TypeScript project | Dave Voyles
So it got the jQuery type definition from the remote DefinitelyTyped repository, and installed it in my local project. typings-directory.
Read more >
Google Publisher Tags add official TypeScript type definitions
Until now, a number of community-led projects such as @types/doubleclick-gpt and @types/googletag have provided unofficial GPT type definitions.
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