We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
SMTPServerSession.user
Let me know if this isn't the right repo to put this issue.
In the onAuth handler, I pass an object through the user parameter. It says in the documentation that this is fine.
onAuth
user
onAuth (auth, session, callback) { const account = getAccountFromSMTP(auth) // ... return callback(null, { user: account }) }
But then, when I use this account in the onRcptTo handler, Typescript tells me that user is a string!
onRcptTo
onRcptTo (address, session, callback) { const account = session.user account.doStuff() // ERROR: Property 'doStuff' does not exist on type 'string'. }
This makes sense, as that's what's written in the type definitions:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a23f844346b0013a6bbc74ef0ddea16c127e815f/types/smtp-server/index.d.ts#L119
string
any
Thanks!
The text was updated successfully, but these errors were encountered:
A workaround:
(session.user as unknown as Account).doStuff()
Sorry, something went wrong.
Any next steps I could take?
No branches or pull requests
Let me know if this isn't the right repo to put this issue.
In the
onAuth
handler, I pass an object through theuser
parameter. It says in the documentation that this is fine.But then, when I use this account in the
onRcptTo
handler, Typescript tells me thatuser
is a string!This makes sense, as that's what's written in the type definitions:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/a23f844346b0013a6bbc74ef0ddea16c127e815f/types/smtp-server/index.d.ts#L119
Possible solutions
string
toany
.SMTPServerSession.user
to be the same as whatever type was passed through inonAuth
.Thanks!
The text was updated successfully, but these errors were encountered: