Since Typescript is a type safe language why ==
still exist? Is there a reason for it?
Generally you should avoid ==
there is even a tslint rule in this regard. There are some valid use cases around null
and undefined
equality, namely null == undefined
while null !== undefined
so if you use ===
you need to check for both undefined
and null
in cases where a value is missing (as both null
and undefined
can be used for missing) which is inconvenient.
As far as the reasoning behind keeping it, I think the defining line from their site says it best "Typescript is a typed superset of JavaScript" so everything from Javascript was kept just augmented with types, including ==