Argument becomes implicit any when a void-returning overload follows a non-void-returning signature
See original GitHub issueBug Report
🔎 Search Terms
overload argument type signature
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about overloads (and #48077)
⏯ Playground Link
Playground link with relevant code
💻 Code
declare const it: {
(test: () => Promise<void>): void;
(test: (input: string) => void): void;
}
it((input) => {
input.toUpperCase();
});
it(async () => {
// ..
});
🙁 Actual behavior
Error: Parameter 'input' implicitly has an 'any' type.
🙂 Expected behavior
No type error. The input
parameter is type string
and should be resolved as such.
For more context, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/59075.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Considerations in Overloading Procedures - Visual Basic
When you overload a procedure, you must use a different signature ... by all languages, and parameter arrays are limited to Visual Basic....
Read more >Immutable objects
It is defined by an accessor method: A zero argument, non- void -returning Java method. No annotations are required on abstract accessor methods...
Read more >Proposal: allow absl::FunctionRef - Google Groups
I'm not sure I follow how the argument for absl::FunctionRef is different from the arguments presented in the std::function thread.
Read more >Morphing: Structurally Shaping a Class by Reflecting on Others
the following code iterates over the public, non-void-returning methods of X, ... over all non-void returning method of the type parameter X ....
Read more >Structural Abstraction A Mechanism for Modular Program ...
non-void-returning methods of X, such that there is also some method in X with the same name, taking no argument: <R,Y*>[meth]for ( public...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The problem is that we assign a contextual type during overload resolution, and don’t have an acceptable way to “undo” that. Prior attempts to fix this have failed for one reason or another.
See also #11936
Hmm, now that #29374 is in I was looking forward to making another multi-year pull request. Great…!