Skip to content
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

Add a signature "(...args: any[]): any" to interface "CallableFunction" #41225

Closed
whzx5byb opened this issue Oct 24, 2020 · 2 comments
Closed
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@whzx5byb
Copy link

Search Terms

function callable signature

Suggestion

There are some posts(#20007, #34540) about Function and (...args: any[]): any. It seems this is an intended design.

The original intention of Function is to not be callable.

But a CallableFunction should be "callable" in semantics. It should be allowed to assign CallableFunction to (...args: any[]): any.(and vice versa)

Checklist

My suggestion meets these guidelines:

  • [*] This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • [*] This wouldn't change the runtime behavior of existing JavaScript code
  • [*] This could be implemented without emitting different JS based on the types of the expressions
  • [*] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • [*] This feature would agree with the rest of TypeScript's Design Goals.
@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Oct 26, 2020
@RyanCavanaugh
Copy link
Member

It's callable because it has a call method. This interface is basically an implementation detail of the compiler; if you want (...args: any[]): any then write (...args: any[]): any

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants