withastro/astro

Generated `astro:actions` types don't work with `"module": "NodeNext"`

Closed this issue · 0 comments

Astro Info

Astro                    v4.16.16
Node                     v20.12.0
System                   Linux (x64)
Package Manager          pnpm
Output                   server
Adapter                  @astrojs/node
Integrations             @astrojs/solid-js

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When using astro:actions and TypeScript configured to use ESM (via "module": "NodeNext" and "moduleResolution": "NodeNext"), the type of the actions export is any, because the autogenerated actions.d.ts imports the directory, which is not supported.

If I manually edit that file and change /src/actions to /src/actions/index.ts the type system works again.

What's the expected result?

Action types should be inferred correctly.

Link to Minimal Reproducible Example

https://codesandbox.io/p/devbox/tr9tq6?file=%2Fsrc%2Fcomponents%2FTestComponent.tsx%3A11%2C1

Participation

  • I am willing to submit a pull request for this issue.