Auth0Client.getUser()returnPromise<any>, which provides no useful type information about what is returned. The properties of the user profile are known, and they should be specified. Otherwise, the value of using TypeScript is diminished.
Auth0Client.getUser()should returnPromise<Auth0UserProfile>notPromise<any>.
Currently casting the returned user to
Auth0UserProfile, which I found in @types/auth0-js.
One of the reasons we don't type this is because the user profile can be pretty fluid; there might be other things in there (adding using the Rules feature, for example).
However, I agree that we could use generics here to configure what the return type is if you know what you're expecting back in terms of ID token claims. I will add that to our backlog for investigation - thanks!
Thanks @stevehobbsdev
I realize that several of the properties of the user profile would have to have any types, but typing the top-level properties would still be extremely helpful.
Most helpful comment
Thanks @stevehobbsdev
I realize that several of the properties of the user profile would have to have
anytypes, but typing the top-level properties would still be extremely helpful.