google / google/closure-compiler

Inline annotations for optional parameters requires ES6 syntax

Open
#2,096 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

I think this should be supported simply by this:

`function foo(/** (string|undefined) */ optional) { ... }`

since calling `foo()` with no arguments will give the `optional` parameter the `undefined` value.

On the other hand, maybe this could be supported as well:

`function foo(/** string= */ optional) { ... }`

Currently this generates no warning or error, but the `=` seems to be silently ignored.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.