Open
Description
Environment
System:
OS: Linux 6.13 Fedora Linux 41 (Workstation Edition)
CPU: (16) x64 13th Gen Intel(R) Core(TM) i5-1340P
Memory: 16.27 GB / 29.08 GB
Container: Yes
Shell: 5.2.32 - /bin/bash
Binaries:
Node: 23.6.0 - ~/.nvm/versions/node/v23.6.0/bin/node
npm: 11.1.0 - ~/.nvm/versions/node/v23.6.0/bin/npm
npmPackages:
@auth/core: ^0.38.0 => 0.38.0
Reproduction URL
https://github.com/james-pre/axium/tree/main/server
Describe the issue
When building a package with Auth.js installed as a dependency, there are multiple errors with @auth/core
:
node_modules/@auth/core/lib/utils/cookie.d.ts:1:45 - error TS2305: Module '"../../types.js"' has no exported member 'RequestInternal'.
1 import type { CookieOption, LoggerInstance, RequestInternal } from "../../types.js";
~~~~~~~~~~~~~~~
node_modules/@auth/core/lib/utils/webauthn-utils.d.ts:2:48 - error TS2305: Module '"../../types.js"' has no exported member 'InternalOptions'.
2 import type { Account, Authenticator, Awaited, InternalOptions, RequestInternal, ResponseInternal, User } from "../../types.js";
~~~~~~~~~~~~~~~
node_modules/@auth/core/lib/utils/webauthn-utils.d.ts:2:65 - error TS2305: Module '"../../types.js"' has no exported member 'RequestInternal'.
2 import type { Account, Authenticator, Awaited, InternalOptions, RequestInternal, ResponseInternal, User } from "../../types.js";
~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:1:50 - error TS2307: Cannot find module 'nodemailer' or its corresponding type declarations.
1 import type { Transport, TransportOptions } from "nodemailer";
~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:2:32 - error TS2307: Cannot find module 'nodemailer/lib/json-transport/index.js' or its corresponding type declarations.
2 import * as JSONTransport from "nodemailer/lib/json-transport/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:3:36 - error TS2307: Cannot find module 'nodemailer/lib/sendmail-transport/index.js' or its corresponding type declarations.
3 import * as SendmailTransport from "nodemailer/lib/sendmail-transport/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:4:31 - error TS2307: Cannot find module 'nodemailer/lib/ses-transport/index.js' or its corresponding type declarations.
4 import * as SESTransport from "nodemailer/lib/ses-transport/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:5:27 - error TS2307: Cannot find module 'nodemailer/lib/smtp-pool/index.js' or its corresponding type declarations.
5 import * as SMTPPool from "nodemailer/lib/smtp-pool/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:6:32 - error TS2307: Cannot find module 'nodemailer/lib/smtp-transport/index.js' or its corresponding type declarations.
6 import * as SMTPTransport from "nodemailer/lib/smtp-transport/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/nodemailer.d.ts:7:34 - error TS2307: Cannot find module 'nodemailer/lib/stream-transport/index.js' or its corresponding type declarations.
7 import * as StreamTransport from "nodemailer/lib/stream-transport/index.js";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/oauth.d.ts:15:44 - error TS2552: Cannot find name 'EndpointHandler'. Did you mean 'TokenEndpointHandler'?
15 export type AuthorizationEndpointHandler = EndpointHandler<AuthorizationParameters>;
~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/oauth.d.ts:16:36 - error TS2552: Cannot find name 'EndpointHandler'. Did you mean 'TokenEndpointHandler'?
16 export type TokenEndpointHandler = EndpointHandler<UrlParams, {
~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/oauth.d.ts:30:39 - error TS2552: Cannot find name 'EndpointHandler'. Did you mean 'TokenEndpointHandler'?
30 export type UserinfoEndpointHandler = EndpointHandler<UrlParams, {
~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/oauth.d.ts:182:43 - error TS2552: Cannot find name 'OAuthConfigInternal'. Did you mean 'OIDCConfigInternal'?
182 export type OIDCConfigInternal<Profile> = OAuthConfigInternal<Profile> & {
~~~~~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/webauthn.d.ts:4:15 - error TS2305: Module '"../types.js"' has no exported member 'InternalOptions'.
4 import type { InternalOptions, RequestInternal, SemverString, User } from "../types.js";
~~~~~~~~~~~~~~~
node_modules/@auth/core/providers/webauthn.d.ts:4:32 - error TS2305: Module '"../types.js"' has no exported member 'RequestInternal'.
4 import type { InternalOptions, RequestInternal, SemverString, User } from "../types.js";
How to reproduce
npm init -y
npm install typescript @auth/core
- Create the tsconfig.json
{
"compilerOptions": {
"strict": true,
"verbatimModuleSyntax": true,
"lib": ["ESNext"],
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ESNext",
"declaration": true,
"outDir": "dist"
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules"]
}
Note that isolatedModules
has no effect on the errors.
- Create some code, importing
@auth/core
—import type * as auth from '@auth/core';
is sufficient - Try to compile with
npx tsc
Expected behavior
@auth/core
should not have these issues.
Adding nodemailer
and @hexagon/base64
to the dependencies should resolve the errors concerning missing dependencies.
As for the missing exports— these types are defined, however they appear to be missing in the build (i.e. in node_modules/@auth/core/types.{js,d.ts}
).