-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[v2.2.1] Auth0Plugin is incompatible with Auth0VueClient (exactOptionalPropertyTypes: true) #240
Comments
Thanks, I can reproduce this and will look into a fix for this. |
@SimonSimCity which version did you upgrade from? I'm seeing the same error and trying to figure the last working version. thanks |
@jonasingvar I'm back on |
I opened a PR that I believe should solve this. The change might be a bit different as you would expect, but I believe it makes sense and elaborated on it in the PR: #243 . Could you verify it solves your compilation issues by doing:
The above commands result in a file called
After that, can you try compiling your application and see if it solves the problem? |
@frederikprijck I have to see and investigate how this could solve the problem I'm facing here ... As far as I understand the problem, it's not that some are read-only and others not, it's that their types are incompatible.
This would be either solved by allowing the properties on the class The above should yield regardless of whether they're read-only or not. I'll nevertheless take the time to check out your changes and see how it affects my code. |
Yeah I understand what you mean. The thing is, one of the two incorrect types (the one for We could cast the response from readonly(): We could do that, but the question is for what? There isn't a real need for using We could also opt for changing the types in the User (and IdTokenClaims) to be:
However, this is a type from outside this SDK. Even though we could update that, it's worth asking ourselves if that's what we want if we know the readonly() might not be something we actualy need to use. |
PR #243 fixes it for me. I can now successfully run |
Any chance you have found the time to give the PR a try @SimonSimCity ? Thanks! |
Tested, works 😎👍 I've also created a bug-report in the repo for typescript 😊 microsoft/TypeScript#55058 |
Thanks, I think strictly speaking we may want to update the types to be:
So I would assume that might be their response. We can still do that eventually, as I think it might be better. I just felt like removing readonly could be the better decision here. |
Checklist
Description
After updating to v2.2.1, my typscript compiler complains when assigning a value of type
Auth0Plugin
to a variable defined as typeAuth0VueClient
.Error:
The types of the values
user
of the interfaceAuth0VueClient
and the classAuth0Plugin
are incompatible in that the class defines it as:... but the interface refers to the class
User
which is defined as:When having the option
exactOptionalPropertyTypes
set totrue
, an optional property is different to an optional property which can also be undefined.Reproduction
exactOptionalPropertyTypes
totrue
in your Typescript configurationAdditional context
No response
auth0-vue version
2.2.1
Vue version
3.3.4
Which browsers have you tested in?
Other
The text was updated successfully, but these errors were encountered: