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
letvalue;// ^? let value: anyif(Math.random()<0.5){value=/hello/;value// ^? let value: RegExp}else{value=12;value// ^? let value: number}value// ^? let value: number | RegExp
letvalue=null;// ^? let value: anytry{value=doSomethingRiskyAndReturnANumber();value// ^? let value: number}catch(e){console.warn('alas!');}value// ^? let value: number | null
functionrange(start: number,limit: number){constnums=[];// ~~~~ Variable 'nums' implicitly has type 'any[]' in some// locations where its type cannot be determinedif(start===limit){returnnums;// ~~~~ Variable 'nums' implicitly has an 'any[]' type}for(leti=start;i<limit;i++){nums.push(i);}returnnums;}
functionmakeSquares(start: number,limit: number){constnums=[];// ~~~~ Variable 'nums' implicitly has type 'any[]' in some locationsrange(start,limit).forEach(i=>{nums.push(i*i);});returnnums;// ~~~~ Variable 'nums' implicitly has an 'any[]' type}