-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: error TS2315: Type 'Uint8Array' is not generic. #19152
Comments
Can you create a reproduction without angular? |
Just hit this problem as well. Seems latest pdfjs uses the most recent TS version (5.7), which introduced those generic types. While Angular (even v19) doesn't support 5.7 yet: Instead of disabling type check for all libs via the workaround OP suggested, you can also install a pre 4.9 version of |
I have the same issue, "skipLibCheck": true is solving compilation error but have this kinde of error Error: No "GlobalWorkerOptions.workerSrc" specified, i donot need to use worker at all, will it]d be posaable to use withour worker , actually nee dto convert pdf into image |
@levan-dolidze GlobalWorkerOptions.workerSrc is a separate issue. There are some suggestions for solving it in #17245. |
Is it possible for TypeScript to generate some kind of "compatibility" or "legacy" types, with better support for older environments? As mentioned in #19000 (comment), we don't really want to get stuck on an older (and slightly arbitrary) TypeScript version. |
For Babel, we have a copy-pasted version of the This means that users on an old TypeScript version don't get types for new features, but at least they don't get errors when updating. |
Attach (recommended) or Link to PDF file
n/a
Web browser and its version
NodeJS version 20.14.0-23.3.0
Operating system and its version
MacOS 15.1.1
PDF.js version
4.9.124
Is the bug present in the latest PDF.js version?
Yes
Is a browser extension
No
Steps to reproduce the problem
npm install -g @angular/cli
ng new UInt8ArrayBug --default
cd UInt8ArrayBug
npm run start
to verify that the Angular app starts, then ctrl-C to exitnpm install --save pdfjs-dist
class AppComponent
adddocument?: PDFDocumentProxy
npm run start
againWhat is the expected behavior?
Angular app should run.
What went wrong?
Angular doesn't start when pdfjs-dist 4.9.124 is installed and referenced.
Link to a viewer
No response
Additional context
As of version 4.9.124, pdfjs-dist throws several copies of error TS2315: Type 'Uint8Array' is not generic.
In the console, I see snippets like this:
I'm not sure what changed to cause the error. Looking over the most recent patch notes, I see #19000 - perhaps that's related somehow?
As a workaround, in tsconfig.json we've set:
skipLibCheck tells TypeScript to skip type checking of dependencies like pdf.js. This should keep the issue at bay until our app needs to interact with the code that's throwing type errors.
The text was updated successfully, but these errors were encountered: