From eaf187f2c40493abec28113c742ef392c812d0e2 Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Wed, 20 Jul 2022 00:33:11 +0000 Subject: [PATCH] Fixing TypeScript type definitions for image components (#3980) * moving back to importing from components directory * exporting components with a .ts file instead of .js * chore: changeset --- .changeset/perfect-islands-teach.md | 5 +++++ packages/integrations/image/README.md | 8 ++++---- .../integrations/image/components/{index.js => index.ts} | 0 packages/integrations/image/src/types.ts | 1 - .../image/test/fixtures/basic-image/src/pages/index.astro | 2 +- .../test/fixtures/basic-picture/src/pages/index.astro | 2 +- 6 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 .changeset/perfect-islands-teach.md rename packages/integrations/image/components/{index.js => index.ts} (100%) diff --git a/.changeset/perfect-islands-teach.md b/.changeset/perfect-islands-teach.md new file mode 100644 index 000000000..7d83eb44d --- /dev/null +++ b/.changeset/perfect-islands-teach.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': patch +--- + +Fixing TypeScript definition exports for image components diff --git a/packages/integrations/image/README.md b/packages/integrations/image/README.md index fef238891..35136f568 100644 --- a/packages/integrations/image/README.md +++ b/packages/integrations/image/README.md @@ -104,7 +104,7 @@ export default { ```html --- -import { Image } from '@astrojs/image'; +import { Image } from '@astrojs/image/components'; import heroImage from '../assets/hero.png'; --- @@ -132,7 +132,7 @@ import heroImage from '../assets/hero.png'; ```html --- -import { Image } from '@astrojs/image'; +import { Image } from '@astrojs/image/components'; const imageUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'; --- @@ -156,7 +156,7 @@ const imageUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelog ```html --- setup: | - import { Image } from '@astrojs/image' + import { Image } from '@astrojs/image/components' import hero from '../../assets/blog/introducing-astro.jpg' title: Hello world! publishDate: 12 Sep 2021 @@ -181,7 +181,7 @@ description: Just a Hello World Post! ```html --- -import { Picture } from '@astrojs/image'; +import { Picture } from '@astrojs/image/components'; import hero from '../assets/hero.png'; const imageUrl = 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'; diff --git a/packages/integrations/image/components/index.js b/packages/integrations/image/components/index.ts similarity index 100% rename from packages/integrations/image/components/index.js rename to packages/integrations/image/components/index.ts diff --git a/packages/integrations/image/src/types.ts b/packages/integrations/image/src/types.ts index 4aafe762d..58a1c59f4 100644 --- a/packages/integrations/image/src/types.ts +++ b/packages/integrations/image/src/types.ts @@ -1,5 +1,4 @@ /// -export type { Image, Picture } from '../components/index.js'; export * from './index.js'; interface ImageIntegration { diff --git a/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro b/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro index 34deda90e..57b7fd97c 100644 --- a/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro +++ b/packages/integrations/image/test/fixtures/basic-image/src/pages/index.astro @@ -1,6 +1,6 @@ --- import socialJpg from '../assets/social.jpg'; -import { Image } from '@astrojs/image'; +import { Image } from '@astrojs/image/components'; --- diff --git a/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro b/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro index f51760e79..fdaf5b6b9 100644 --- a/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro +++ b/packages/integrations/image/test/fixtures/basic-picture/src/pages/index.astro @@ -1,6 +1,6 @@ --- import socialJpg from '../assets/social.jpg'; -import { Picture } from '@astrojs/image'; +import { Picture } from '@astrojs/image/components'; ---