Typescript increases value for any datatype using pipe (|)
I have declare a variable of type any.
While assigning the values as per below & I am printing it on console, so its updating the value from 50 to 51.
I am using pipe (|) symbol
Please help me & guide me if anything I am doing wrong.
let myVariable: any;
myVariable = "hello";
console.log("1 condition: " + myVariable);
myVariable = 20;
console.log("2 condition: " + myVariable);
myVariable = 50 | true | "false";
console.log("3 condition: " + myVariable);
Thanks
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Laxmidhar SahooRank #383 · 6.6K reputationPosted Dec 20, 2019, 7:56 PM EST
Rajeesh MenothRank #118 · 18.4K reputationPosted Dec 20, 2019, 9:28 PM EST