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

fix(ts): fix internal react type import #2450

Merged
merged 2 commits into from
Aug 12, 2021
Merged

fix(ts): fix internal react type import #2450

merged 2 commits into from
Aug 12, 2021

Conversation

grikomsn
Copy link
Contributor

This PR fixes an improper import path for the internal React client for the next version, from "internals/react" to "./internals/react".

Reasoning 💡

While internals/react is a valid import for the project scope (depending on the tsconfig baseUrl), on dist builds it cannot resolve internals/react which breaks all typings that is related to the React client functions.

This PR aims to fix this issue, which I have tested by manually changing the import path. For reproducibility, below is a patch file generated using patch-package:

diff --git a/node_modules/next-auth/react.d.ts b/node_modules/next-auth/react.d.ts
index 0a3b3ec..9d0f67d 100644
--- a/node_modules/next-auth/react.d.ts
+++ b/node_modules/next-auth/react.d.ts
@@ -2,7 +2,7 @@ import * as React from "react"
 import { IncomingMessage } from "http"
 import { Session } from "."
 import { ProviderType } from "./providers"
-import { SessionContextValue } from "internals/react"
+import { SessionContextValue } from "./internals/react"
 
 export interface CtxOrReq {
   req?: IncomingMessage

Checklist 🧢

- [ ] Documentation
- [ ] Tests
- [ ] Ready to be merged

Affected issues 🎟

So far there are no issues related to this problem.

@vercel
Copy link

vercel bot commented Jul 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nextauthjs/next-auth/3GdBENtetX4kBTHcRkaBhW6CXv2n
✅ Preview: https://next-auth-git-fork-grikomsn-fix-next-fix-reac-7818aa-nextauthjs.vercel.app

@vercel vercel bot temporarily deployed to Preview July 29, 2021 16:45 Inactive
@github-actions github-actions bot added the TypeScript Issues relating to TypeScript label Jul 29, 2021
@vercel vercel bot temporarily deployed to Preview August 12, 2021 08:52 Inactive
@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #2450 (92fb2c0) into next (b50a2eb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             next    #2450   +/-   ##
=======================================
  Coverage   11.56%   11.56%           
=======================================
  Files          85       85           
  Lines        1314     1314           
  Branches      370      370           
=======================================
  Hits          152      152           
  Misses        966      966           
  Partials      196      196           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b50a2eb...92fb2c0. Read the comment docs.

@balazsorban44 balazsorban44 changed the title fix(types): fix internal react type import for next version fix(ts): fix internal react type import Aug 12, 2021
@balazsorban44 balazsorban44 merged commit 92b9d22 into nextauthjs:next Aug 12, 2021
@balazsorban44
Copy link
Member

Thanks!

@grikomsn grikomsn deleted the fix/next-fix-react-type-import branch August 14, 2021 06:27
mnphpexpert added a commit to mnphpexpert/next-auth that referenced this pull request Sep 2, 2024
Co-authored-by: Lluis Agusti <hi@llu.lu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TypeScript Issues relating to TypeScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants