SharePoint / PnP-JS-Core

Code moved to https://github.com/pnp/pnpjs. This repository is archived.
Other
379 stars 231 forks source link

return type for getAll #810

Closed russgove closed 6 years ago

russgove commented 6 years ago

Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your needs please complete the below template to ensure we have the details to help. Thanks!

Please check out the Developer Guide to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.

Category

[x ] Enhancement

[ ] Bug

[ ] Question

Version

Hi, I am using this code to return an array of typed objects public getRoleToTransaction(role: string): Promise { return sp.web.lists.getByTitle(this.properties.roleToTransactionListName) .items.filter(Composite_x0020_role eq '${role}').get(); }

I returned results list may be huge in some rare cases so I want to use GetAll(): public getRoleToTransaction(role: string): Promise { return sp.web.lists.getByTitle(this.properties.roleToTransactionListName) .items.filter(Composite_x0020_role eq '${role}').getAll(); }

But getAll doesn't take a type parameter.

Can we make getAll take a type parameter?

patrick-rodgers commented 6 years ago

You can type the return to anything you like. It is any so something like:


const h = <something>sp...getAll();

// or

const y: something = sp...getAll();

Not sure what advantage adding a type parameter would have here?

Thank you for your interest in the sp-pnp-js library. We wanted to mention that this library is being deprecated in July, 2018 in favor of the new scoped pnpjs libraries. You should begin transitioning your existing projects when possible, or start new projects with the new libraries. Please see the transition guide for more details on migrating and be sure to let us know if you have any questions. Thanks!

russgove commented 6 years ago

Thanks Patrick! I did not know that.