mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
fix(config): expose correct types (#13388)
* fix(config): expose correct types * feat: type tests --------- Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
This commit is contained in:
parent
249d52a3ff
commit
afadc702d7
3 changed files with 22 additions and 2 deletions
5
.changeset/lazy-llamas-pull.md
Normal file
5
.changeset/lazy-llamas-pull.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes a bug where `astro:config/server` and `astro:config/client` had incorrect types.
|
4
packages/astro/client.d.ts
vendored
4
packages/astro/client.d.ts
vendored
|
@ -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' {
|
||||
|
|
15
packages/astro/test/types/astro-config-virtual-module.ts
Normal file
15
packages/astro/test/types/astro-config-virtual-module.ts
Normal file
|
@ -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>();
|
||||
})
|
||||
})
|
Loading…
Add table
Reference in a new issue