Azure / azure-sdk-for-js

This repository is for active development of the Azure SDK for JavaScript (NodeJS & Browser). For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/javascript/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-js.
MIT License
2.09k stars 1.21k forks source link

next(): Promise<IteratorResult<T,T>>; -> Method from core-paging is giving a error. #19394

Closed sudeepghosh0 closed 2 years ago

sudeepghosh0 commented 2 years ago

Describe the bug A clear and concise description of what the bug is.

ERROR in ../node_modules/@azure/core-paging/types/3.1/core-paging.d.ts:16:21 - error TS2314: Generic type 'IteratorResult' requires 1 type argument(s).

16 next(): Promise<IteratorResult<T,T>>;

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

ramya-rao-a commented 2 years ago

@sudeepghosh0 Can you please share a code snippet that can show how to reproduce the error?

sudeepghosh0 commented 2 years ago

Steps to reproduce the error:- Create a simple project in angular - 8. Run - npm install @azure/storage-blob Create a angular service and implement a uploadblob function. When you are done with the above steps do "ng serve" and you should get the error. Attaching my service file for reference. sample-service-file.txt

jeremymeng commented 2 years ago

The latest supported TypeScript version is 3.4.5 for Angular 8. We probably need to support more down-level versions like we did in #10599

jeremymeng commented 2 years ago

Ah, we deleted our hand-crafted 3.1 type definition, and replaced it with the output of api-extractor #16732, which doesn't have the expected types. Look like downlevel-dts cannot handle the breaking changes in the type definitions.

jeremymeng commented 2 years ago

So we had had a hand-crafted core-paging.d.ts for 3.1 where we used IteratorResult<T>. After replaced it with downlevel-dts and api-extractor output, we now have IteratorResult<T,T> which isn't expected by lower versions (< 3.6) of TypeScript compiler

deyaaeldeen commented 2 years ago

Hi @sudeepghosh0, thanks for filing this report! I created a fix in https://github.com/Azure/azure-sdk-for-js/pull/19507. Until the fix is released, you can use this patched package.

Please let me know if you have any questions!

ghost commented 2 years ago

Hi @sudeepghosh0. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

sudeepghosh0 commented 2 years ago

Thanks for the quick response. can you please tell me how can i use the patched package in my project. if i run "npm i @azure/core-paging@1.2.0" its installing the old packages only. " next(): Promise<IteratorResult<T, T>>;"

deyaaeldeen commented 2 years ago

@sudeepghosh0 please download the tarball file from the link I shared above and then run npm install <path to the tarball file> in your NodeJS project directory.

sudeepghosh0 commented 2 years ago

Thank You.

ramya-rao-a commented 2 years ago

@deyaaeldeen Please use the patched package only for testing and not in production. For your production usage, please wait for the official release which we should be able to get out in the first week of January 2022

Leodecko commented 2 years ago

Hello, is there a fix for this issue? I have the same problem.

deyaaeldeen commented 2 years ago

@Leodecko Could you please share the version of @azure/core-paging installed in your project and the typescript compiler? v1.2.1 has the fix in https://github.com/Azure/azure-sdk-for-js/pull/19507.

Leodecko commented 2 years ago

Actually, the azure/storage-blob library is the one that is causing the issue I'm not using @azure/core-paging, the version of the storage-blob that we are using in our angular 8 protect is: 12.8.0 Thanks in advanced

deyaaeldeen commented 2 years ago

Thanks @Leodecko for the information!

Could you please share the full error and the version of @azure/storage-blob you're using?

Leodecko commented 2 years ago

image

When we try to build the app this is the error that is throwing us. Our typescript version is : 3.5.3

deyaaeldeen commented 2 years ago

@Leodecko thanks! The error is coming from core-paging which is one of the dependencies of @azure/storage-blob. @azure/core-paging@1.2.1 is the most recent version of that package and has a fix for this issue. Could you please upgrade the dependencies in your project by deleting the node_modules folder and running npm install again to install latest versions?

You can also try installing @azure/core-paging@1.2.1 explicitly by running npm install @azure/core-paging@^1.2.1.

Please let me know whether this solved the issue.

maorleger commented 2 years ago

@Leodecko just FYI, Deya and I chatted and we want to recommend that instead of installing @azure/core-paging as a top-level dependency can you try the following:

# show the version of core-paging which I assume is 1.2.0 at this time
angular8 main % npm ls @azure/core-paging
angular8@0.0.0 /home/mleger/workspace/azure-sdk-experiments/local/angular8
└─┬ @azure/storage-blob@12.8.0
  └── @azure/core-paging@1.2.0 

# update @azure/core-paging to 1.2.1 (the latest) 
angular8 main % npm update @azure/core-paging

# show the version of core-paging again, which should be 1.2.1
angular8 main % npm ls @azure/core-paging
angular8 main % npm ls @azure/core-paging              
angular8@0.0.0 /home/mleger/workspace/azure-sdk-experiments/local/angular8
└─┬ @azure/storage-blob@12.8.0
  └── @azure/core-paging@1.2.1 

Hopefully that helps get you on a version of core-paging that contains the fix without deleting node_modules or your lock-file. let us know if that resolves your issues!

Just FYI - if nothing happens after you run npm update, you might be on an older version of npm and can try

npm update @azure/core-paging --depth 2