-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Wrong type definitions on user.signOut() #11109
Comments
Hi @seivan we are working on improvements to our types and TypeScript so I will bring this up with the rest of the team to ensure it gets included in the efforts. Thanks for bringing it to our attention! |
Do you want me to fix it? Or rewrite the cognito layer in TS? I don’t mind and would probably fix most of your issues. |
Hi @seivan if you would like to fix the As I mentioned there is a large effort to rewrite the TS in the library in the works, so I would ask that you don't expend the extra effort to rewrite the entire cognito layer in TS. |
Sure!
Is there an open Roadmap and feedback pipeline? I mean the default API leaves a lot to wish for, not just types but better ergonomics. Say something as simple as getting the public getEmail = async (): Promise<string> => {
const context = errorContextCreator("Validate Session")
return Promise
.resolve(this._cognitoUser)
.then(u => {
if (u == null) { throw context("no user") }
else { return u }
})
.then(user => {
return new Promise((resolve, reject) => {
user.getUserData((errorData, valueData) => {
Promise
.resolve({errorData, valueData})
.then(response => {
if (response.errorData != null) { throw context("get user data failed", response.errorData) }
else { return response.valueData }
})
.then(data => {
if (data == null) { throw context("get user data returned empty") }
else { return data.UserAttributes }
})
.then(attributes => {
return attributes.find(a => {
return a.Name.toLowerCase() === "email"
})?.Value
})
.then(email => {
if (email == null || email == "") { throw context("no email found") }
else { return email }
})
.then(email => {
// this._cognitoEmailAttribute = email
resolve(email)
})
.catch(e => {
reject(e)
})
})
})
})
} |
Hi @seivan I was waiting for it to go live but you can check out this new RFC for typescript improvements and leave feedback there so that we can hopefully incorporate all of your feedback. |
With the release of the latest major version of Amplify (aws-amplify@>6), this issue should now be resolved! Please refer to our release announcement, migration guide, and documentation for more information. |
Before opening, please confirm:
JavaScript Framework
Not applicable
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
The signature is incorrect for
signOut
since it passes an error in the callback, but missing in type definitionExpected behavior
The signature for
signOut
should pass an optional error in the callbackReproduction steps
Code Snippet
// Put your code below this line.
Log output
No response
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: