Skip to content
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

Extend types accepted by DatasetContext to include (SolidDataset & WithAcp) #219

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ameyabhat
Copy link

This commit allows the DatasetContext component to be used with (SolidDataset & WithAcp)

Checklist

  • All acceptance criteria are met.
  • [n/a] Relevant documentation, if any, has been written/updated.
  • The changelog has been updated, if applicable.
  • [n/a] New functions/types have been exported in index.ts, if applicable.
  • Commits in this PR are minimal and have descriptive commit messages.

Copy link
Contributor

@Vinnl Vinnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ABhat00 Could you clarify what error you're running into? Anything that accepts a SolidDataset should also accept a (SolidDataset & WithAcp) as far as I'm aware (and a (SolidDataset & WithResourceInfo), for that matter).

@ameyabhat
Copy link
Author

Right now, the DatasetContext component will accept a (SolidDataset & WithACP) but will only return a SolidDataset, which means that I'm not able to use any of the acp functions on the dataset I've kept in context. I was looking to make the component return the(SolidDataset & WithAcp) if that was passed to it to solve that issue

@Vinnl
Copy link
Contributor

Vinnl commented Jan 11, 2021

@ABhat00 Ah I see - that requires using a generic to link the input type to the output type. See for example how we've done that for setThing, whose output SolidDataset has the same type as the input, with the addition of WithChangeLog. (There, Dataset is the generic.)

Also note that your import statement imports from the dist folder, rather than directly from @inrupt/solid-client. Although Webpack 4 and below allow just reaching into a package and importing from whatever file is available there, this will break once this library migrates to Webpack 5.

Base automatically changed from master to main February 5, 2021 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants