Closed spenserblack closed 1 year ago
There's existing rules for whether comments are included are not, and type annotations would just be another form of comment, so I assume it'd follow those same rules and include the examples indicated.
Like Jordan said:
function foo(a /*number*/) {}
foo.toString(); // 'function foo(a /*number*/) {}'
Thanks for the prompt answers! I'll close this as "answered."
Right now,
.toString()
returns a string representation of the function's source code:Python, which is mentioned a few times in this proposal and its issues, has this behavior:
I understand that Python's types are very different from this proposal's type annotations, and that Python's
help
is not the same asFunction.prototype.toString
, but this made me wonder if "a string representation of the function's source code" would include the type annotations, and result in something like this: