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
functionadd(a: number,b: number): number{if(isNaN(a)||isNaN(b)){return'Not a number!';// ~~~ Type 'string' is not assignable to type 'number'.}return(a|0)+(b|0);}
test('out-of-domain add',()=>{expect(add(null,null)).toEqual(0);// ~~~~ Type 'null' is not assignable to parameter of type 'number'.expect(add(null,12)).toEqual(12);// ~~~~ Type 'null' is not assignable to parameter of type 'number'.expect(add(undefined,null)).toBe(NaN);// ~~~~~~~~~ Type 'undefined' is not assignable to parameter of ...expect(add('ab','cd')).toEqual('abcd');// ~~~~ Type 'string' is not assignable to parameter of type 'number'.});