From 0a2732a2b0be45121b772f8de5e271439e3bd888 Mon Sep 17 00:00:00 2001 From: "Lyu, Wei-Da" <36730922+jasonlyu123@users.noreply.github.com> Date: Thu, 6 Jul 2023 17:38:24 +0800 Subject: [PATCH] fix: generate type definition with nullable types (#8924) This results in `undefined` and `null` being added explicitly in places which is crucial in some situations --- .changeset/funny-bags-occur.md | 5 +++++ packages/svelte/scripts/generate-dts.js | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/funny-bags-occur.md diff --git a/.changeset/funny-bags-occur.md b/.changeset/funny-bags-occur.md new file mode 100644 index 0000000000..81f89bcd0f --- /dev/null +++ b/.changeset/funny-bags-occur.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: generate type definition with nullable types diff --git a/packages/svelte/scripts/generate-dts.js b/packages/svelte/scripts/generate-dts.js index fe4b70e09a..0ecf7127df 100644 --- a/packages/svelte/scripts/generate-dts.js +++ b/packages/svelte/scripts/generate-dts.js @@ -16,6 +16,9 @@ fs.writeFileSync('./types/compiler/interfaces.d.ts', `import '../index.js';`); await createBundle({ output: 'types/index.d.ts', + compilerOptions: { + strict: true + }, modules: { svelte: 'src/runtime/public.d.ts', 'svelte/compiler': 'src/compiler/public.d.ts',