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

make selectionSet input readonly #24

Merged
merged 2 commits into from
Oct 23, 2023
Merged

make selectionSet input readonly #24

merged 2 commits into from
Oct 23, 2023

Conversation

iartemiev
Copy link
Member

Description of changes:
selectionSet input value accepts array literals (as const). This allows using an array literal for the value as well as with the SelectionSet util type.

const postSelectionSet = ['id', 'title', 'comments.*'] as const

// value
await client.models.Post.list({ selectionSet: postSelectionSet })

// type
type MyPost = SelectionSet<Schema['Post'], typeof postSelectionSet>

This is an additional way to define a custom selection set. The existing inline definition using a regular string array without a const assertion remains available:

await client.models.Post.list({ selectionSet: ['id', 'title', 'comments.*'] })

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@changeset-bot
Copy link

changeset-bot bot commented Oct 22, 2023

🦋 Changeset detected

Latest commit: a466af3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-amplify/amplify-api-next-types-alpha Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@iartemiev iartemiev requested a review from svidgen October 22, 2023 23:05
@iartemiev iartemiev merged commit cf5fddd into main Oct 23, 2023
4 checks passed
@iartemiev iartemiev deleted the fix-sel-set-type branch October 23, 2023 13:25
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.

2 participants