nuxt-auth-utils icon indicating copy to clipboard operation
nuxt-auth-utils copied to clipboard

fix issue #433: UserSession type safety was broken

Open fischi20 opened this issue 3 months ago • 4 comments

UserSession type safety broke due to the Omit<> type not being able to handle Index Signatures.

This should get back the type safety to the setUserSession and replaceUserSession.

I did not check for other occurrences of this problem across the codebase because it was the only time It came up for me, And the only time mentioned by the issue #433, I hope the position for the utility types is fine; otherwise, just let me know where to put them, and I will change that

fischi20 avatar Sep 23 '25 23:09 fischi20

Thank you @fischi20

Could you please fix the lint & test?

I think the file can be in src/runtime/types/utils.d.ts

atinux avatar Sep 24 '25 18:09 atinux

Hey, thank you for the feedback. I fixed lint errors and tests passed before too. Sorry for forgetting about lints

I just wanted to ask, since I did not touch it, I don't mind leaving it there, but in the file src/runtime/server/utils/session.ts at line 115, the SessionConfig.cookie.sameSite type is stricter than the assigned string type. Should I add a @ts-expect with a small comment or just leave it?

fischi20 avatar Sep 24 '25 19:09 fischi20

Open in StackBlitz

npm i https://pkg.pr.new/atinux/nuxt-auth-utils@459

commit: 663747a

pkg-pr-new[bot] avatar Oct 02 '25 08:10 pkg-pr-new[bot]

Is anything needed to merge this request? I'm implementing nuxt-auth-utils and just ran into this issue.

Thanks

gnomebrew avatar Nov 06 '25 22:11 gnomebrew