Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/frank-papayas-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes type errors reported in Astro's built-in `<Picture />` and `<Font />` components when type-checking a project with `tsc` and `@astrojs/ts-content-mapper`
1 change: 1 addition & 0 deletions packages/astro/components/Font.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
// @ts-ignore-error This virtual module is resolved by Astro at runtime and declared in dev-only.d.ts.
Comment thread
Princesseuh marked this conversation as resolved.
Resolved
import { componentDataByCssVariable } from 'virtual:astro:assets/fonts/internal';
import { filterPreloads } from '../dist/assets/fonts/core/filter-preloads.js';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/components/Picture.astro
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ const originalSrc = await resolveSrc(props.src);
// When inferSize is set for a remote image, resolve dimensions once and thread them through
// to all getImage() calls. This avoids multiple redundant HTTP requests to the same URL,
// which can trigger rate-limiting (HTTP 429) on servers like Wikimedia.
if (props.inferSize && isRemoteImage(originalSrc)) {
if ('inferSize' in props && props.inferSize && isRemoteImage(originalSrc)) {
const remoteSize = await inferRemoteSize(originalSrc);
delete props.inferSize;
delete (props as { inferSize?: boolean }).inferSize;
props.width ??= remoteSize.width;
props.height ??= remoteSize.height;
}
Expand Down
Loading