diff options
author | 2025-03-10 16:41:02 +0100 | |
---|---|---|
committer | 2025-03-10 15:41:02 +0000 | |
commit | afadc702d7d928e7b650d3c071cca3d21e14333f (patch) | |
tree | 832227bfca5b7a53616bd8dee51c2d65ada24e81 | |
parent | 249d52a3ff17f792c451ea0e42b97a209667290c (diff) | |
download | astro-afadc702d7d928e7b650d3c071cca3d21e14333f.tar.gz astro-afadc702d7d928e7b650d3c071cca3d21e14333f.tar.zst astro-afadc702d7d928e7b650d3c071cca3d21e14333f.zip |
fix(config): expose correct types (#13388)
* fix(config): expose correct types
* feat: type tests
---------
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
-rw-r--r-- | .changeset/lazy-llamas-pull.md | 5 | ||||
-rw-r--r-- | packages/astro/client.d.ts | 4 | ||||
-rw-r--r-- | packages/astro/test/types/astro-config-virtual-module.ts | 15 |
3 files changed, 22 insertions, 2 deletions
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<ServerDeserializedManifest>(); + }) + it('astro:config/client', () => { + expectTypeOf(client).toEqualTypeOf<ClientDeserializedManifest>(); + }) +})
\ No newline at end of file |