Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

return type for getAll #810

Closed
russgove opened this issue May 14, 2018 · 2 comments
Closed

return type for getAll #810

russgove opened this issue May 14, 2018 · 2 comments

Comments

@russgove
Copy link
Contributor

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
Copy link
Contributor

patrick-rodgers commented May 15, 2018

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
Copy link
Contributor Author

Thanks Patrick! I did not know that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants