Closed as not planned
Description
🔎 Search Terms
- function signature
- wrong type
- changed
- re-assigned
- re-declared
- type inference
🕗 Version & Regression Information
- This is the behavior in every version (
3.3.3333
and5.2.2
) I tried, and I reviewed the FAQ for entries about bugs that aren't bugs.
⏯ Playground Link
💻 Code
let someFunc = (a: Object) => a;
const a = someFunc({});
someFunc = () => 5;
const b = someFunc();
🙁 Actual behavior
It doesn't compile and there is an error on the second call to someFunc
saying that an argument is not supplied.
🙂 Expected behavior
Because someFunc
was redefined it doesn't actually expect an argument and the code is correct.
Additional information about the issue
When using the function
keyword, the inferred type is correct (although it doesn't compile either but this time because there is a duplicate function implementation):