wip: scaffold content types

This commit is contained in:
bholmesdev 2023-02-08 10:10:39 -05:00
parent 7a941a0b2d
commit 336810b2cf
3 changed files with 21 additions and 1 deletions

View file

@ -0,0 +1,19 @@
declare module 'astro:content' {
type ComponentRenderer =
| JSX.Element
| {
component: JSX.Element;
props?(params: {
attributes: Record<string, any>;
getTreeNode(): import('@markdoc/markdoc').Tag;
}): Record<string, any>;
};
interface Render {
'.mdoc': {
Content(props: {
components: Record<string, ComponentRenderer>;
config: import('@markdoc/markdoc').Config;
}): Promise<JSX.Element>;
};
}
}

View file

@ -21,6 +21,7 @@
"exports": { "exports": {
".": "./dist/index.js", ".": "./dist/index.js",
"./components": "./components/index.ts", "./components": "./components/index.ts",
"./content-types": "./content-types.d.ts",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"scripts": { "scripts": {

View file

@ -1,6 +1,6 @@
{ {
"extends": "../../../tsconfig.base.json", "extends": "../../../tsconfig.base.json",
"include": ["src", "components"], "include": ["src", "components", "content-types.d.ts"],
"compilerOptions": { "compilerOptions": {
"allowJs": true, "allowJs": true,
"module": "ES2020", "module": "ES2020",