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
When using @AssertType decoator on async methods, calling the method throws synchronously instead of returning rejected promise.
@AssertType
async
example:
@ValidateClass() export class MessageHandler { async handleMessage(@AssertType() body: { feedId: string }): Promise<void> { console.log(body); } } new MessageHandler() .handleMessage({ invalidMessage: 123 }) // error: throws synchronously here! .catch(e => { // …should be able to handle TypeGuardError here })
It would be perfect to make @AssertType aware of async keyword or Promise return type, but is it even possible?
Promise
The text was updated successfully, but these errors were encountered:
I've done my research on decorators and metadata and prepared a PR addressing the issue: https://github.com/woutervh-/typescript-is/pull/105
Sorry, something went wrong.
Merge pull request #105 from HitoriSensei/fix/issue-104
6938d9d
#104 @AssertType rejects a promise when used in async methods
No branches or pull requests
When using
@AssertType
decoator onasync
methods, calling the method throws synchronously instead of returning rejected promise.example:
It would be perfect to make
@AssertType
aware ofasync
keyword orPromise
return type, but is it even possible?The text was updated successfully, but these errors were encountered: