From eb36e95596fcdb3db4a31744e910495e22e3af84 Mon Sep 17 00:00:00 2001 From: Erika <3019731+Princesseuh@users.noreply.github.com> Date: Sat, 23 Dec 2023 02:52:04 -0500 Subject: [PATCH] feat: export JSX types from jsx-runtime (#9501) * feat: export JSX types from jsx-runtime * fix: i wont make the same mistakes three times * chore: changeset --- .changeset/chilly-tips-breathe.md | 5 +++++ packages/astro/jsx-runtime.d.ts | 6 ++++++ packages/astro/package.json | 8 +++++--- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changeset/chilly-tips-breathe.md create mode 100644 packages/astro/jsx-runtime.d.ts diff --git a/.changeset/chilly-tips-breathe.md b/.changeset/chilly-tips-breathe.md new file mode 100644 index 000000000000..6e622f8264df --- /dev/null +++ b/.changeset/chilly-tips-breathe.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Export JSX namespace from `astro/jsx-runtime` for language tooling to consume diff --git a/packages/astro/jsx-runtime.d.ts b/packages/astro/jsx-runtime.d.ts new file mode 100644 index 000000000000..84afab48286b --- /dev/null +++ b/packages/astro/jsx-runtime.d.ts @@ -0,0 +1,6 @@ +// Q: Why this file? +// A: Our language tooling needs to access the JSX types from `astro/jsx-runtime`, due to TS limitations, however we +// can't import `astro-jsx` types inside the actual `jsx-runtime/index.js` file due to circular dependency issues. +import './astro-jsx.js'; +export * from './dist/jsx-runtime/index.js'; +export import JSX = astroHTML.JSX; diff --git a/packages/astro/package.json b/packages/astro/package.json index fd68d82ee72e..bc142674421a 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -34,12 +34,14 @@ "./env": "./env.d.ts", "./types": "./types.d.ts", "./client": "./client.d.ts", - "./import-meta": "./import-meta.d.ts", "./astro-jsx": "./astro-jsx.d.ts", "./tsconfigs/*.json": "./tsconfigs/*", "./tsconfigs/*": "./tsconfigs/*.json", "./jsx/*": "./dist/jsx/*", - "./jsx-runtime": "./dist/jsx-runtime/index.js", + "./jsx-runtime": { + "types": "./jsx-runtime.d.ts", + "default": "./dist/jsx-runtime/index.js" + }, "./compiler-runtime": "./dist/runtime/compiler/index.js", "./runtime/*": "./dist/runtime/*", "./config": { @@ -90,9 +92,9 @@ "zod.mjs", "env.d.ts", "client.d.ts", + "jsx-runtime.d.ts", "content-types.template.d.ts", "content-module.template.mjs", - "import-meta.d.ts", "astro-jsx.d.ts", "types.d.ts", "README.md",