google / google/closure-compiler

arrow functions should not be allowed as constructors

Open
#3,550 1 comment 0 reactions 0 assignees View on GitHub
P3
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

https://closure-compiler-debugger.appspot.com/#input0%3D%252F**%250A%2520%2520*%2520%2540param%2520%257Bfunction(new%253AObject)%257D%2520newable%250A%2520%2520*%252F%250Afunction%2520register(newable)%2520%257B%250A%2520%2520return%2520new%2520newable()%253B%250A%257D%250A%250Aclass%2520A%2520%257B%257D%250A%250Aregister(A)%253B%250Aregister(()%2520%253D%253E%2520%257B%257D)%253B%26input1%26conformanceConfig%26externs%26refasterjs-template%26CHECK_TYPES%3Dtrue%26REWRITE_MODULES_BEFORE_TYPECHECKING%3Dtrue%26CLOSURE_PASS%3Dtrue%26PRESERVE_TYPE_ANNOTATIONS%3Dtrue%26PRETTY_PRINT%3Dtrue

see example above. we have the parameter `@param {function(new:Object)} newable` and we pass in a `() =>` arrow function which will be new'd up and we get `Uncaught TypeError: newable is not a constructor`

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.