From 6fc80f08d5476d2fa2d96afe246d87da735b1aaa Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Thu, 22 Aug 2024 11:23:17 +0200 Subject: [PATCH 1/3] Use new dts-buddy capabilities and the corresponding tsconfig option to strip away types/properties (and their dependencies) that are marked with `@internal` --- packages/svelte/scripts/generate-types.js | 4 + .../svelte/src/compiler/types/template.d.ts | 18 +- packages/svelte/types/index.d.ts | 245 +----------------- 3 files changed, 23 insertions(+), 244 deletions(-) diff --git a/packages/svelte/scripts/generate-types.js b/packages/svelte/scripts/generate-types.js index ed9009df6a22..7678ed35b1c9 100644 --- a/packages/svelte/scripts/generate-types.js +++ b/packages/svelte/scripts/generate-types.js @@ -21,6 +21,10 @@ fs.writeFileSync(`${dir}/types/compiler/interfaces.d.ts`, "import '../index.js'; await createBundle({ output: `${dir}/types/index.d.ts`, + compilerOptions: { + // so that types/properties with `@internal` (and its dependencies) are removed from the output + stripInternal: true + }, modules: { [pkg.name]: `${dir}/src/index.d.ts`, [`${pkg.name}/action`]: `${dir}/src/action/public.d.ts`, diff --git a/packages/svelte/src/compiler/types/template.d.ts b/packages/svelte/src/compiler/types/template.d.ts index a4480ce2f12b..36f59c4e33ad 100644 --- a/packages/svelte/src/compiler/types/template.d.ts +++ b/packages/svelte/src/compiler/types/template.d.ts @@ -22,13 +22,14 @@ export interface BaseNode { type: string; start: number; end: number; - /** This is set during parsing on elements/components/expressions/text (but not attributes etc) */ + /** @internal This is set during parsing on elements/components/expressions/text (but not attributes etc) */ parent: SvelteNode | null; } export interface Fragment { type: 'Fragment'; nodes: Array; + /** @internal */ metadata: { /** * Fragments declare their own scopes. A transparent fragment is one whose scope @@ -63,6 +64,7 @@ export interface Root extends BaseNode { instance: Script | null; /** The parsed `