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 don't know the exact terms for what's happening in the first example. Are these parameters' "types being inferred"?
// `text` has type `string`window.alert=(text)=>{returnwindow.alert(text);}// Both parameters are `any`, because `addEventListener` has overloadswindow.addEventListener=(type,fn)=>{returnwindow.addEventListener(type,fn);}
Expected behavior:
They should follow these types from lib.dom.d.ts:
For overload sets with "terminal" signatures that encompass all of the preceding ones, this is sufficient, but for other overload sets where there are "disjoint" signatures (e.g. number => string + string => number) this process doesn't produce correct results.
TypeScript Version: 3.9.2
Search Terms:
noImplicitAny true
overloaded
inferred types
Code
I don't know the exact terms for what's happening in the first example. Are these parameters' "types being inferred"?
Expected behavior:
They should follow these types from
lib.dom.d.ts
:Actual behavior:
Playground Link: https://www.typescriptlang.org/play/#src=window.alert%20%3D%20(text)%20%3D%3E%20%7B%0D%0A%09return%20window.alert(text)%3B%0D%0A%7D%0D%0A%0D%0Awindow.addEventListener%20%3D%20(type%2C%20fn)%20%3D%3E%20%7B%0D%0A%09return%20window.addEventListener(type%2C%20fn)%3B%0D%0A%7D
The text was updated successfully, but these errors were encountered: