VadimDez / ng2-pdf-viewer

📄 PDF Viewer Component for Angular
https://vadimdez.github.io/ng2-pdf-viewer/
MIT License
1.31k stars 420 forks source link

error TS2583: Cannot find name 'AsyncGenerator' #1143

Closed Subhakarpandey closed 1 month ago

Subhakarpandey commented 1 month ago
Bug Report or Feature Request (mark with an x)
 node_modules/ng2-pdf-viewer/node_modules/pdfjs-dist/types/web/genericl10n.d.ts:12:77 - error TS2583: Cannot find name 'AsyncGenerator'. Do you need to change your target library? Try changing the 'lib' compiler option to 
'es2018' or later.

12     static "__#61@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;

I already have tsc Version 5.2.2, npm version 10.5.2
"ng2-pdf-viewer": "~10.3.3",
Angular : ^17.3.0"

try to delete nod_modules , and then npm install but the issue does not fixed .

Will you please suggest
Subhakarpandey commented 1 month ago

your page is link is not safe, it is malicious link

shamoon commented 1 month ago

I reported it to GH earlier, they're usually reasonably fast about removing these

Subhakarpandey commented 1 month ago

Ok, Can you please suggest how would I solve this issue

Angular 17 Package.Json dependencies": { "@angular/animations": "^17.3.0", "@angular/cdk": "^17.3.0", "@angular/common": "^17.3.0", "@angular/compiler": "^17.3.0", "@angular/core": "^17.3.0", "@angular/forms": "^17.3.0", "@angular/material": "^17.3.0", **"@angular/platform-browser": "^17.3.0",** "@angular/platform-browser-dynamic": "^17.3.0", "@angular/platform-server": "^17.3.0", "@angular/router": "^17.3.0", "@ngx-translate/core": "^15.0.0", "@ngx-translate/http-loader": "^8.0.0", "@popperjs/core": "^2.10.2", "@types/jspdf": "^1.1.31", "classlist-polyfill": "^1.2.0", "concat": "^1.0.3", "core-js": "^2.4.1", "file-saver": "^2.0.5", "intl": "^1.2.5", "mddir": "^1.1.0", "ng2-pdf-viewer": "~10.3.3" } Package.lock.json "node_modules/ng2-pdf-viewer": { "version": "10.3.3", "resolved": "https://registry.npmjs.org/ng2-pdf-viewer/-/ng2-pdf-viewer-10.3.3.tgz", "integrity": "sha512-eam4AWvycg30XoepPydEgkZ86JrLHFw12+k4VUKH/6Fxw6gkhNM8ZiaSgRAI9b6VyT4F7wZmaARobDSzy6MjKA==", "dependencies": { "pdfjs-dist": "4.6.82", "tslib": "^2.3.0" }

tsconfig.json ``"compilerOptions": { "skipLibCheck":true "downlevelIteration": true, "importHelpers": true, "outDir": "../Scripts/1.0.0.0/angular/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "experimentalDecorators": true, "target": "es2022", "typeRoots": [ "node_modules/@types"

],
"types": [
  "jquery",
  "jasmine"
],
"lib": [
  "es2022",
  "dom",
  "es2022",
   "esnext.asynciterable"

],
"module": "es2022",
"baseUrl": "./"

}``

Error is es2018' or later.

12 static "__#61@#generateBundles"(defaultLang: string, baseLang: string): AsyncGenerator<any, void, unknown>;

`

shamoon commented 1 month ago

This is clearly not an ng2-pdf-viewer problem

I'd google it https://www.google.com/search?q=Cannot+find+name+%27AsyncGenerator%27

Subhakarpandey commented 1 month ago

This is clearly not an ng2-pdf-viewer problem

I'd google it https://www.google.com/search?q=Cannot+find+name+%27AsyncGenerator%27

it is work when I downgrade to old "ng2-pdf-viewer": "~10.0.0"

but the moment I upgrade to ng2-pdf-viewer": "~10.3.3" , it gives error

I have googled it , but none of the approached worked

Subhakarpandey commented 1 month ago

it works, after investigation we need to add this

 "lib": [
      "es2022",
      "dom",
      "esnext.asynciterable"
    ],
**tsconfig.app.json** as well 
Subhakarpandey commented 1 month ago

Closed