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:
TypeScript Version: 3.5.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