Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoimport from effect is not typed correctly #2384

Open
rijenkii opened this issue Apr 20, 2024 · 0 comments
Open

Autoimport from effect is not typed correctly #2384

rijenkii opened this issue Apr 20, 2024 · 0 comments

Comments

@rijenkii
Copy link

rijenkii commented Apr 20, 2024

Environment

Node: v20.12.2
Nitro: 2.9.6
Config:

export default defineNitroConfig({
  srcDir: "server",
  imports: {
    imports: [{ from: "effect", name: "Effect" }],
  },
});

Reproduction

https://github.com/rijenkii/nitro-effect-autoimport-bug

Describe the bug

After adding effect to autoimport, references of Effect in the project get assigned type any:
image

In .nitro/types/nitro-imports.d.ts row which imports Effect looks like this:

const Effect: typeof import('../../node_modules/effect/dist/esm/index')['Effect']

And it also contains the following error:

Could not find a declaration file for module '../../node_modules/effect/dist/esm/index'.
'/tmp/nitro-app/node_modules/effect/dist/esm/index.js' implicitly has an 'any' type. ts(7016)

Replacing esm in the line to dts fixes the problem, but it is rewritten on every generation.

Additional context

I've tried adding typeFrom: "../../node_modules/effect/dist/dts/index" to the import config as a temporary workaround, but it did not do anything: nitro-imports.d.ts still generates with effect/dist/esm/index.

Logs

No response

@rijenkii rijenkii changed the title Autoimport from effect does not type correctly Autoimport from effect is not typed correctly Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant