google / google/closure-compiler

[ES6] Inline argument type for arrow function requires parentheses

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

Description

Inline (`/** Foo */`-style) type annotations are ignored for single-argument arrow functions unless the (normally optional) parentheses are included around the argument.

See [demo](http://closure-compiler-debugger.appspot.com/#input0%3Dlet%2520foo%2520%253D%2520%252F**%2520number%2520*%252F%2520x%2520%253D%253E%2520x%2520*%25202%253B%250Afoo%28'a'%29%253B%250A%250Alet%2520bar%2520%253D%2520%28%252F**%2520number%2520*%252F%2520x%29%2520%253D%253E%2520x%2520*%25202%253B%250Abar%28'a'%29%253B%26input1%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1)

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.