Do you want to request a _feature_ or report a _bug_?
Bug
What is the current behavior?
Usage of t.Function is marked as deprecated without a clear alternative.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://codesandbox.io/ or similar.
Look at the docs to see that t.Function is deprecated. Or run tslint with tslint-config-standard on code using t.Function to see it complain about deprecation.
What is the expected behavior?
t.Function should not be marked deprecated, or an alternative type for validating functions should be added.
Which versions of io-ts, and which browser and OS are affected by this issue? Did this work in previous versions of io-ts?
Current version: 1.8.7, worked in versions prior to 1.8.3
@gcanti Why is it an all or nothing scenario? There are many use cases for validating that a value is, at the very least, a function even if there's no way to check the signature.
For example, we have libraries written in typescript that are used in plain javascript runtimes and io-ts is used to validate that the arguments passed in conform to the static typescript types. A common occurrence would be passing in an options object containing a callback or event handler attribute. t.Function would be used inside the options object type to verify at runtime that the attribute really is a function and our library can safely use it as one. Even if the signature is incorrect that responsibility would fall on the consumer of the library which is in line with expectations of existing nodejs libraries with function parameters.
Considering 'function' is a fundamental type in javascript it doesn't seem sensible to remove it.
Most helpful comment
@gcanti Why is it an all or nothing scenario? There are many use cases for validating that a value is, at the very least, a function even if there's no way to check the signature.
For example, we have libraries written in typescript that are used in plain javascript runtimes and
io-tsis used to validate that the arguments passed in conform to the static typescript types. A common occurrence would be passing in an options object containing a callback or event handler attribute.t.Functionwould be used inside the options object type to verify at runtime that the attribute really is a function and our library can safely use it as one. Even if the signature is incorrect that responsibility would fall on the consumer of the library which is in line with expectations of existing nodejs libraries with function parameters.Considering 'function' is a fundamental type in javascript it doesn't seem sensible to remove it.