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

Declaration files use the wrong extension #23

Closed
DallasHoff opened this issue Apr 17, 2024 · 3 comments
Closed

Declaration files use the wrong extension #23

DallasHoff opened this issue Apr 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@DallasHoff
Copy link
Contributor

DallasHoff commented Apr 17, 2024

When attempting to import something in an app from one of the mjs files, e.g.,

import { getUserSession } from 'nuxt-oidc-auth/runtime/server/utils/session.mjs';

...TypeScript is unable to resolve the declaration file and errors on that line.

Could not find a declaration file for module 'nuxt-oidc-auth/runtime/server/utils/session.mjs'. 'node_modules/nuxt-oidc-auth/dist/runtime/server/utils/session.mjs' implicitly has an 'any' type.

The declaration file next to session.mjs is named session.d.ts. Renaming this file to session.d.mts fixes the error and brings in the types correctly. Nuxt Module Builder is outputting the declaration files with the wrong extension.

This issue might be related.

@itpropro
Copy link
Owner

itpropro commented Apr 17, 2024

It actually looks like a upstream issue, thanks for reporting!
I will see if we can do anything from our side or if we need to wait on a fix in mkdist.
Is this blocking something you try to achieve currently and is a workaround needed or is this just blocking you from getting correct declarations?

@DallasHoff
Copy link
Contributor Author

Is this blocking something you try to achieve currently and is a workaround needed or is this just blocking you from getting correct declarations?

Just correct declarations. I can put a @ts-expect-error above the import line for now.

@itpropro itpropro added the bug Something isn't working label Apr 18, 2024
@itpropro
Copy link
Owner

@DallasHoff this was fixed upstream by nuxt module tooling updates. Can you verify if the error is gone for you with the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants