This project is read-only.

RestParameter can be improved

Topics: Language Specification
Jul 15, 2013 at 9:31 PM
Instead of:
RestParameter = ... Identifier TypeAnnotation(opt)

Should be strict array type:
RestParameter = ... Identifier ArrayType(opt)
Jul 22, 2013 at 3:11 PM
Is this not enforced later by the type-checker? Oh, do you mean that only 'any[]' should be allowed and not 'any'?
Jul 23, 2013 at 1:40 PM
It is enforced.
But grammar doesn't say you are allowed to use 'Array' instead of [].
function f(...a : Array<number>) {}

function g(...a : number[]) {}
Both legal but grammar doesn't say so.
It is said that Array<T> is same as T[] , so it is likely to be implied.