itpropro / nuxt-oidc-auth

OIDC (OpenID connect) focused auth module for Nuxt
https://nuxt.com/modules/nuxt-oidc-auth
MIT License
68 stars 13 forks source link

Declaration files use the wrong extension #23

Open DallasHoff opened 5 months ago

DallasHoff commented 5 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 2 weeks ago

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