-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict Reflect.apply Reflect.construct and Function.prototype.apply/call/bind #33889
Comments
I'd expect
|
The original use case code has an error and has been fixed. Since |
Just checking whether the spread operator available to you? const args = [];
new ClassA(...args); // ClassA |
This is not an issue about how to dynamically create an object instance. |
Would you consider adding more information about your use case? |
This issue is equivalent to say: add type guard for Example: function foo(name: string) {
console.log(name)
}
foo.apply(null, [42]); // typescript will report type error, great!
Function.prototype.apply.call(foo, null, [42]); // no error 😢
Reflect.apply(foo, null, [42]); // no error 😢 |
Search Terms
Reflect.apply
Reflect.construct
Function.prototype.apply
Function.prototype.call
Function.prototype.bind
Suggestion
These functions should not return
any
.Related:
#212
#27028
Use Cases
Examples
Reflect:
Checklist
My suggestion meets these guidelines:
👆 Add a new compiler option
The text was updated successfully, but these errors were encountered: