You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I see with the above code (from providers.d.ts in next-auth@latest) is that for something as simple as to extend the Union type inside OAuthProviderType with my custom provider name then I have to retype everything if I want to rebase my new provider type from the builtin types (which I suspected is was the majority wants to do).
Probably a suggestion here is to use some generics there so we can build our custom provider types more easily.
So I would like to do type CustomOAuthProvider = OAuthProviders<OAuthProviderType | 'MyProvider'> and let;s say OAuthProviders is a type util that comes from next-auth to help us build custom types for custom providers. This is just with one generic but a second one could be added to help us extend options as well. This could be extended to different parts of the app, like adapters and so on. Just an idea
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The problem I see with the above code (from providers.d.ts in
next-auth@latest
) is that for something as simple as to extend the Union type insideOAuthProviderType
with my custom provider name then I have to retype everything if I want to rebase my new provider type from the builtin types (which I suspected is was the majority wants to do).Probably a suggestion here is to use some generics there so we can build our custom provider types more easily.
So I would like to do
type CustomOAuthProvider = OAuthProviders<OAuthProviderType | 'MyProvider'>
and let;s say OAuthProviders is a type util that comes from next-auth to help us build custom types for custom providers. This is just with one generic but a second one could be added to help us extend options as well. This could be extended to different parts of the app, like adapters and so on. Just an ideaHow are you managing this currently on TS?
Beta Was this translation helpful? Give feedback.
All reactions