Answers for "gument of type 'Number' is not assignable to parameter of type 'string | number'. Type 'Number' is not assignable to type 'number'. 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible."

0

gument of type 'Number' is not assignable to parameter of type 'string | number'. Type 'Number' is not assignable to type 'number'. 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.

 
let numValue=100;                   //primitive number
let numObject = new Number(1500);   //Number object
 
numValue=numObject;       //Compile Error 
numObject=numValue;       //ok
 
 
***** Error *****
Type 'Number' is not assignable to type 'number'.
  'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible.ts(2322)
 
Posted by: Guest on August-13-2021

Code answers related to "gument of type 'Number' is not assignable to parameter of type 'string | number'. Type 'Number' is not assignable to type 'number'. 'number' is a primitive, but 'Number' is a wrapper object. Prefer using 'number' when possible."

Browse Popular Code Answers by Language