Open
Description
Checklist
- The issue can be reproduced in the auth0-react sample app (or N/A).
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
Since User has been declared as a fixed type, it is no longer possible to set the Context created from Auth0ContextInterface<CustomUser extends user> in the context property of Auth0Provider.
This seems to be caused by merging the pull request below.
https://github.com/auth0/auth0-react/pull/401/files
Reproduction
I want to set the context to CustomUser, which extends User, as shown below, but I get a type error
class CustomUser extends user {
getSomeInfo : () => {
....
}
}
export const CustomAuth0Provider = ({ children }: { children: React.ReactNode }) => {
const customContext = createContext<Auth0ContextInterface<CustomUser>>(initialCustomAuthContext);
return (
<Auth0Provider
domain={domain}
clientId={clientId}
context={customContext} // Type Error
authorizationParams={{
redirect_uri: redirectUri,
audience: audience,
scope: "openid profile email",
}}>
{children}
</Auth0Provider>
);
}
Additional context
No response
auth0-react version
2.2.4
React version
18.2
Which browsers have you tested in?
Chrome