Export AstroConfigType properly as type and not as a Zod schema value (#7702)
This commit is contained in:
parent
1e9902177d
commit
c19987df0b
4 changed files with 10 additions and 4 deletions
5
.changeset/green-islands-repeat.md
Normal file
5
.changeset/green-islands-repeat.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fix AstroConfigSchema type export
|
|
@ -13,10 +13,9 @@ import type { AddressInfo } from 'node:net';
|
|||
import type * as rollup from 'rollup';
|
||||
import type { TsConfigJson } from 'tsconfig-resolver';
|
||||
import type * as vite from 'vite';
|
||||
import type { z } from 'zod';
|
||||
import type { SerializedSSRManifest } from '../core/app/types';
|
||||
import type { PageBuildData } from '../core/build/types';
|
||||
import type { AstroConfigSchema } from '../core/config';
|
||||
import type { AstroConfigType } from '../core/config';
|
||||
import type { AstroTimer } from '../core/config/timer';
|
||||
import type { AstroCookies } from '../core/cookies';
|
||||
import type { LogOptions, LoggerLevel } from '../core/logger/core';
|
||||
|
@ -1354,7 +1353,7 @@ export interface ResolvedInjectedRoute extends InjectedRoute {
|
|||
* Resolved Astro Config
|
||||
* Config with user settings along with all defaults filled in.
|
||||
*/
|
||||
export interface AstroConfig extends z.output<typeof AstroConfigSchema> {
|
||||
export interface AstroConfig extends AstroConfigType {
|
||||
// Public:
|
||||
// This is a more detailed type than zod validation gives us.
|
||||
// TypeScript still confirms zod validation matches this type.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
||||
export { createNodeLogging } from './logging.js';
|
||||
export { mergeConfig } from './merge.js';
|
||||
export type { AstroConfigSchema } from './schema';
|
||||
export type { AstroConfigType } from './schema';
|
||||
export { createSettings } from './settings.js';
|
||||
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
||||
|
|
|
@ -266,6 +266,8 @@ export const AstroConfigSchema = z.object({
|
|||
legacy: z.object({}).optional().default({}),
|
||||
});
|
||||
|
||||
export type AstroConfigType = z.infer<typeof AstroConfigSchema>;
|
||||
|
||||
export function createRelativeSchema(cmd: string, fileProtocolRoot: string) {
|
||||
// We need to extend the global schema to add transforms that are relative to root.
|
||||
// This is type checked against the global schema to make sure we still match.
|
||||
|
|
Loading…
Reference in a new issue