Improve typing on React useSession() update method #9997
Closed
Benjamin-Richard-Carter
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Provide type safety & code completion to the update method
Background
Forgive me if I've misunderstood/overlooked something - I'm quite new to typescript and next-auth, but currently the update method on the React useSession hook is typed as such:
UpdateSession = (data?: any) => Promise<Session | null>
Proposal
In order to provide type checking and code completion when using this method, would it not be more appropriate to type the data parameter as such:
UpdateSession = (data?: Partial<Session>) => Promise<Session | null>
, thus ensuring that any data passed to the method satisfies the Session schemaBeta Was this translation helpful? Give feedback.
All reactions