From 52900b6911e0c2a8971dcc71bcd83478664896d4 Mon Sep 17 00:00:00 2001 From: Viki Date: Fri, 23 Aug 2024 14:29:44 +0800 Subject: [PATCH] chore: add global TS type in `mdx` --- docs/global.d.ts | 9 +++++++++ docs/rspress.config.ts | 2 +- docs/tsconfig.json | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 docs/global.d.ts diff --git a/docs/global.d.ts b/docs/global.d.ts new file mode 100644 index 00000000..aad3f92e --- /dev/null +++ b/docs/global.d.ts @@ -0,0 +1,9 @@ +type Category = string + +type Feature = 'Pausable' | 'IsSupported' | 'LowLevel' | 'DevOnly' + +declare const frontmatter: { + category: Category + features: Feature[] + deprecated?: boolean +} diff --git a/docs/rspress.config.ts b/docs/rspress.config.ts index 04320d87..4f788560 100644 --- a/docs/rspress.config.ts +++ b/docs/rspress.config.ts @@ -64,7 +64,7 @@ export default defineConfig({ builderPlugins, builderConfig: { html: { - tags: [{ tag: 'script', children: "window.RSPRESS_THEME = 'light';" }], + tags: process.env.IS_SODOC ? [{ tag: 'script', children: "window.RSPRESS_THEME = 'light';" }] : [], }, output: { cleanDistPath: true, diff --git a/docs/tsconfig.json b/docs/tsconfig.json index cfa3458d..d0aa3ce5 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -13,7 +13,7 @@ "i18n": ["./i18n.json"] } }, - "include": ["./src/**/*", "./docs/**/*", "../src/**/demo.tsx", "../src/**/*.mdx"], + "include": ["./global.d.ts", "./src/**/*", "./docs/**/*", "../src/**/demo.tsx", "../src/**/*.mdx"], "references": [{ "path": "./tsconfig.node.json" }], "mdx": { "checkMdx": true