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
{}
any
any disables type checking, so any usage of an any expression will be unsafe. For example:
task.tryCatch(() => Promise.resolve(1), error => { // unsafe! return error.foo.bar })
For this reason it is preferable to use the empty object type {}.
For more information on the differences between any and {}, and the how they are often misunderstood, see microsoft/TypeScript#9999 (comment).
Would you be happy for us to change some instances of any to {}? For example, in the onrejected function parameter of task.tryCatch:.
onrejected
task.tryCatch
This would mean the above example would error unless the user widens the type (e.g. using user-defined type guards):
task.tryCatch(() => Promise.resolve(1), error => { // compile error return error.foo.bar })
The text was updated successfully, but these errors were encountered:
LGTM
Sorry, something went wrong.
No branches or pull requests
any
disables type checking, so any usage of anany
expression will be unsafe. For example:For this reason it is preferable to use the empty object type
{}
.For more information on the differences between
any
and{}
, and the how they are often misunderstood, see microsoft/TypeScript#9999 (comment).Would you be happy for us to change some instances of
any
to{}
? For example, in theonrejected
function parameter oftask.tryCatch
:.This would mean the above example would error unless the user widens the type (e.g. using user-defined type guards):
The text was updated successfully, but these errors were encountered: