From 8b0d61c25dd865f6c3de51044fdd16855d8460a6 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Fri, 16 Apr 2021 10:37:01 +0200 Subject: [PATCH] Fix: Add global.d.ts to create-svelte JS version The global.d.ts file makes TS/JS aware of some ambient modules, which are also needed for JS projects if people turn on "checkJs" in their jsonfig --- .changeset/gold-moles-hunt.md | 5 +++++ packages/create-svelte/scripts/build-templates.js | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/gold-moles-hunt.md diff --git a/.changeset/gold-moles-hunt.md b/.changeset/gold-moles-hunt.md new file mode 100644 index 000000000000..37ce21cc7de8 --- /dev/null +++ b/.changeset/gold-moles-hunt.md @@ -0,0 +1,5 @@ +--- +'create-svelte': patch +--- + +add global.d.ts to js version diff --git a/packages/create-svelte/scripts/build-templates.js b/packages/create-svelte/scripts/build-templates.js index 895109de864a..67b592bc670f 100644 --- a/packages/create-svelte/scripts/build-templates.js +++ b/packages/create-svelte/scripts/build-templates.js @@ -49,7 +49,9 @@ async function generate_templates() { const js = { meta, files: [] }; for (const file of ts.files) { - if (file.name.endsWith('.d.ts')) continue; + // The global.d.ts file makes TS/JS aware of some ambient modules, which are + // also needed for JS projects if people turn on "checkJs" in their jsonfig + if (file.name.endsWith('.d.ts') && !file.name.endsWith('global.d.ts')) continue; if (file.name.endsWith('.ts')) { const transformed = transform(file.contents, {