From b0e649a8d9f1b420948fa2a3b5382c4779a00e90 Mon Sep 17 00:00:00 2001 From: Armand Abric Date: Sun, 18 Oct 2026 09:23:03 +0200 Subject: [PATCH] chore: Enable isolatedDeclarations With isolatedDeclarations, tsdown generates the declarations with Oxc instead of TypeScript, so the build no longer depends on the TypeScript API or the tsgo binary. The generated declarations are unchanged. Co-Authored-By: Claude Opus 5.5 --- src/formatter/createPropFilter.ts | 2 +- src/options.ts | 2 +- tsconfig.json | 1 + tsdown.config.ts | 6 ++++-- vitest.config.ts | 6 ++++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/formatter/createPropFilter.ts b/src/formatter/createPropFilter.ts index 9fc97679e..f7611f52b 100644 --- a/src/formatter/createPropFilter.ts +++ b/src/formatter/createPropFilter.ts @@ -2,7 +2,7 @@ export default function createPropFilter( props: Record, filter: string[] | ((propValue: Value, key: string) => boolean), -) { +): (key: string) => boolean { if (Array.isArray(filter)) { return (key: string) => filter.indexOf(key) === -1; } diff --git a/src/options.ts b/src/options.ts index 90b4217bc..6858d7c0c 100644 --- a/src/options.ts +++ b/src/options.ts @@ -27,7 +27,7 @@ export type Options = { // Options accepted by reactElementToJSXString export type PublicOptions = Partial; -export const defaultOptions = { +export const defaultOptions: Options = { filterProps: [], showDefaultProps: true, showFunctions: false, diff --git a/tsconfig.json b/tsconfig.json index 0b0c1cdb3..80dca2f73 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "jsx": "react-jsx", "module": "ESNext", "declaration": true, + "isolatedDeclarations": true, "target": "ESNext", "moduleResolution": "bundler", "strict": true, diff --git a/tsdown.config.ts b/tsdown.config.ts index b4689269e..456daa3f9 100644 --- a/tsdown.config.ts +++ b/tsdown.config.ts @@ -1,6 +1,6 @@ -import { defineConfig } from "tsdown"; +import { type UserConfig, defineConfig } from "tsdown"; -export default defineConfig({ +const config: UserConfig = defineConfig({ entry: ["src/index.ts"], format: ["esm"], sourcemap: true, @@ -15,3 +15,5 @@ export default defineConfig({ }, target: ["node24", "es2020"], }); + +export default config; diff --git a/vitest.config.ts b/vitest.config.ts index b7777e75b..23411ab63 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,7 +1,7 @@ import react from "@vitejs/plugin-react"; -import { defineConfig } from "vitest/config"; +import { type ViteUserConfig, defineConfig } from "vitest/config"; -export default defineConfig({ +const config: ViteUserConfig = defineConfig({ plugins: [react()], test: { globals: false, @@ -10,3 +10,5 @@ export default defineConfig({ mockReset: true, }, }); + +export default config;