From 78bafc5d661ff7dd071c241cb1303c4d8a774d21 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Fri, 8 Mar 2024 14:45:43 +0100 Subject: [PATCH] fix(tsconfigs): Add `jsx: 'preserve'` to the base template (#10368) * fix(tsconfigs): Add `jsx: 'preserve'` to the base template * chore: changeset --- .changeset/slimy-avocados-sniff.md | 5 +++++ packages/astro/tsconfigs/base.json | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/slimy-avocados-sniff.md diff --git a/.changeset/slimy-avocados-sniff.md b/.changeset/slimy-avocados-sniff.md new file mode 100644 index 000000000000..3cf85cd928be --- /dev/null +++ b/.changeset/slimy-avocados-sniff.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Updates the base `tsconfig.json` preset with `jsx: 'preserve'` in order to fix errors when importing Astro files inside `.js` and `.ts` files. diff --git a/packages/astro/tsconfigs/base.json b/packages/astro/tsconfigs/base.json index 371b2a15deb2..f1394474d441 100644 --- a/packages/astro/tsconfigs/base.json +++ b/packages/astro/tsconfigs/base.json @@ -24,6 +24,8 @@ // Skip typechecking libraries and .d.ts files "skipLibCheck": true, // Allow JavaScript files to be imported - "allowJs": true + "allowJs": true, + // Allow JSX files (or files that are internally considered JSX, like Astro files) to be imported inside `.js` and `.ts` files. + "jsx": "preserve" } }