typeof something === 'function'
No longer narrow certain generic typed variable to Function
#54522
Labels
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
Bug Report
typeof something === 'function'
seems no longer narrowsomething
to aFunction
in 5.1.3, whensomething
has a generic type under certain circumstance.🔎 Search Terms
typeof function
🕗 Version & Regression Information
The following code failed to compile on 5.1.3, while typescript prior to 5.0.4 works.- This changed between versions 5.0.4 and 5.1.3Updates:
The following code pass tsc before 4.7.4
fnLength1
is rejected by tsc since 4.8methodFnLength
is rejected by tsc since 5.1⏯ Playground Link
Playground link
💻 Code
🙁 Actual behavior
It does not narrow
fn
toFunction
in all cases.🙂 Expected behavior
It does narrow
fn
toFunction
in all cases as expected.The text was updated successfully, but these errors were encountered: