fix: allow promises for extends

This commit is contained in:
bholmesdev 2023-06-05 16:30:59 -04:00
parent 5160886227
commit 41bfede8f2
2 changed files with 4 additions and 1 deletions

View file

@ -1,11 +1,12 @@
import type { ConfigType as MarkdocConfig } from '@markdoc/markdoc'; import type { ConfigType as MarkdocConfig } from '@markdoc/markdoc';
import _Markdoc from '@markdoc/markdoc'; import _Markdoc from '@markdoc/markdoc';
import { heading } from './heading-ids.js'; import { heading } from './heading-ids.js';
import type { MaybePromise } from './utils.js';
export type AstroMarkdocConfig<C extends Record<string, any> = Record<string, any>> = export type AstroMarkdocConfig<C extends Record<string, any> = Record<string, any>> =
MarkdocConfig & { MarkdocConfig & {
ctx?: C; ctx?: C;
extends?: ResolvedAstroMarkdocConfig[]; extends?: MaybePromise<ResolvedAstroMarkdocConfig>[];
}; };
export type ResolvedAstroMarkdocConfig = Omit<AstroMarkdocConfig, 'extends'>; export type ResolvedAstroMarkdocConfig = Omit<AstroMarkdocConfig, 'extends'>;

View file

@ -3,6 +3,8 @@ import crypto from 'node:crypto';
import path from 'node:path'; import path from 'node:path';
import type { ErrorPayload as ViteErrorPayload } from 'vite'; import type { ErrorPayload as ViteErrorPayload } from 'vite';
export type MaybePromise<T> = T | Promise<T>;
/** /**
* Match YAML exception handling from Astro core errors * Match YAML exception handling from Astro core errors
* @see 'astro/src/core/errors.ts' * @see 'astro/src/core/errors.ts'