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
I think the suggestion here is that a typeof x === "function" type guard should change the type of x to (typeof x) & Function under the guard. We currently do something similar for primitive types, but nothing specific for functions.
TypeScript Version: 2.1.4
The following code gives an error in TS 2.1:
It's not really nice code, but I think it should work never the less :)
Expected behavior:
I would expect this[a] to be typed as this[keyof this] & Function:
Actual behavior:
It gives an error, as of TS 2.1, it worked in TS 2.0 (because mapped types did not exist, this[a] was typed as any)
The text was updated successfully, but these errors were encountered: