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

feat(image): Export more types and utilities for users to use #6739

Merged
merged 2 commits into from
Apr 3, 2023

Conversation

Princesseuh
Copy link
Member

Changes

While porting my website to astro:assets this weekend and building my own Picture component, I noticed that a bunch of types are annoyingly not exported, this PR fixes this

Testing

Tested manually, types only

Docs

Some of those types were already referred to in the docs, but couldn't be exported. This PR fixes this

@Princesseuh Princesseuh requested a review from a team as a code owner April 3, 2023 11:02
@changeset-bot
Copy link

changeset-bot bot commented Apr 3, 2023

🦋 Changeset detected

Latest commit: d2058b1

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

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Apr 3, 2023
@@ -45,7 +38,7 @@ interface GetImageResult {
* import { getImage } from 'astro:assets';
* import originalImage from '../assets/image.png';
*
* const optimizedImage = await getImage({src: originalImage, width: 1280 })
* const optimizedImage = await getImage({src: originalImage, width: 1280 });
Copy link
Member Author

@Princesseuh Princesseuh Apr 3, 2023

Choose a reason for hiding this comment

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

Missing semi-colon here broke syntax highlighting in the hover because of withastro/language-tools#475

Comment on lines +34 to +37
width?: number | undefined;
height?: number | undefined;
quality?: ImageQuality | undefined;
format?: ImageOutputFormat | undefined;
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding undefined here makes it compatible with exactOptionalPropertyTypes. Otherwise, building a component is clumsy because you need to filter out every props manually

@sarah11918 sarah11918 removed the request for review from a team April 3, 2023 12:24
@sarah11918
Copy link
Member

Scanned and didn't see any changes for Astro Docs Maintainers to review, so removed the review request!

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Looks fine to me 👍

@Princesseuh Princesseuh merged commit 2f2e572 into main Apr 3, 2023
@Princesseuh Princesseuh deleted the feat/export-more-types-and-things branch April 3, 2023 16:11
@astrobot-houston astrobot-houston mentioned this pull request Apr 3, 2023
@lilnasy lilnasy mentioned this pull request Feb 1, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants