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
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):
Variables initialized with some expression always assume the widened form of the initializer's type
Assignment will only create a narrowing to a more-specific type if the declared type of the assigned variable is a union
🔎 Search Terms
🕗 Version & Regression Information
3.3.3333
and5.2.2
) I tried, and I reviewed the FAQ for entries about bugs that aren't bugs.⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.2.2#code/DYUwLgBAzg9gtiAYgVwHYGMIF4IAoCGAXBAPIBGAViOmAJTYB8E+A3AFDoypST7bTwkadLgDeAX1rtYCFBn656WJgFZ2nbpDL8ZQjIpZA
💻 Code
🙁 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):https://www.typescriptlang.org/play?#code/GYVwdgxgLglg9mABAZzgWwKYDFwQBQCGAXIgPIBGAVhtAJSIDeiAThlCM0gQNyIC+AKAgJkURAUQBeFOmy48DPrW4DQkWAhmYckPPSat2nRn16DhYUYnJStc3cqA
The text was updated successfully, but these errors were encountered: