Closed sirisian closed 5 years ago
Added here: https://github.com/sirisian/ecmascript-types#typed-arrow-functions
One last thought this brings up. Can an interface define its nullability. That is it always ideal to have the nullability of a type defined explicitly where it's used. For example:
interface IExample?
{
(:uint32?):uint32;
}
Such syntax would mean that every usage of IExample is nullable. This hurts the readability I think of code. That said other languages allow one to define their own types which allow similar things.
function F(a:IExample):void {}
F(null);
I'm unsure, but it's something to think about. Could be added later also I believe with no problems.
I'm gonna say no on nullable interface syntax. It's hard to read.
The use of question mark tokens is now everywhere in the spec. It's probably a good idea to include nullable function syntax so people can help find any edge cases:
So pretty. Along with any example using the above single signature constraint the interfaces syntax should be included also: