Skip to content

Commit

Permalink
Fix: Add global.d.ts to create-svelte JS version (#1051)
Browse files Browse the repository at this point in the history
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

Co-authored-by: Simon Holthausen <simon.holthausen@accso.de>
  • Loading branch information
dummdidumm and Simon Holthausen authored Apr 16, 2021
1 parent 1d76d66 commit 4cffc14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/gold-moles-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

add global.d.ts to js version
4 changes: 3 additions & 1 deletion packages/create-svelte/scripts/build-templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 4cffc14

Please sign in to comment.