You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
This is tricky because we don't currently store whether a function is an arrow or not anywhere in the type model. And because newing classical functions is so common, it's not clear what the rules should be for it. I'm not sure what would happen if we said that a non-constructor is not a subtype of a constructor - likely the world would break.
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 getUncaught TypeError: newable is not a constructor
The text was updated successfully, but these errors were encountered: