From afadc702d7d928e7b650d3c071cca3d21e14333f Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Mon, 10 Mar 2025 16:41:02 +0100 Subject: fix(config): expose correct types (#13388) * fix(config): expose correct types * feat: type tests --------- Co-authored-by: Florian Lefebvre --- .changeset/lazy-llamas-pull.md | 5 +++++ packages/astro/client.d.ts | 4 ++-- packages/astro/test/types/astro-config-virtual-module.ts | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .changeset/lazy-llamas-pull.md create mode 100644 packages/astro/test/types/astro-config-virtual-module.ts diff --git a/.changeset/lazy-llamas-pull.md b/.changeset/lazy-llamas-pull.md new file mode 100644 index 000000000..4a294e755 --- /dev/null +++ b/.changeset/lazy-llamas-pull.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a bug where `astro:config/server` and `astro:config/client` had incorrect types. diff --git a/packages/astro/client.d.ts b/packages/astro/client.d.ts index 543e00d8e..de13ef57c 100644 --- a/packages/astro/client.d.ts +++ b/packages/astro/client.d.ts @@ -193,14 +193,14 @@ declare module 'astro:config/server' { // biome-ignore format: bug type ServerConfigSerialized = import('./dist/types/public/manifest.js').ServerDeserializedManifest; const manifest: ServerConfigSerialized; - export default manifest; + export = manifest; } declare module 'astro:config/client' { // biome-ignore format: bug type ClientConfigSerialized = import('./dist/types/public/manifest.js').ClientDeserializedManifest; const manifest: ClientConfigSerialized; - export default manifest; + export = manifest; } declare module 'astro:components' { diff --git a/packages/astro/test/types/astro-config-virtual-module.ts b/packages/astro/test/types/astro-config-virtual-module.ts new file mode 100644 index 000000000..bf4aba51b --- /dev/null +++ b/packages/astro/test/types/astro-config-virtual-module.ts @@ -0,0 +1,15 @@ +import { expectTypeOf } from "expect-type"; +import { describe, it } from "node:test"; +import type { ServerDeserializedManifest, ClientDeserializedManifest } from "../../dist/types/public"; + +const server = null as typeof import("astro:config/server") +const client = null as typeof import("astro:config/client") + +describe('astro:config', () => { + it('astro:config/server', () => { + expectTypeOf(server).toEqualTypeOf(); + }) + it('astro:config/client', () => { + expectTypeOf(client).toEqualTypeOf(); + }) +}) \ No newline at end of file -- cgit v1.2.3