Also, I believe with String, you can have a null value, and with string, you can't (at least in any typed-language that doesn't support type-reassignment (i.e. Typescript(?)), though, I could be wrong, since I'm basing this off of my knowledge with C# and Java objects).
Since Typescript is a superset of JS (which does not have types), you can assign null to string as well. But if you want to opt out of this behaviour, in your tsconfig you can set, strictNullChecks to true. Now you won't be able to assign null to a string variable.
Yeah. Cool.
Though, I only wish there was a way to use TS in the browser natively, I know it has to be "converted" to JS, but like, why can't we just have it interpreted like JS, and have that as another option? It'd save a hassle.
Also, I believe with
String
, you can have anull
value, and withstring
, you can't (at least in any typed-language that doesn't support type-reassignment (i.e. Typescript(?)), though, I could be wrong, since I'm basing this off of my knowledge with C# and Java objects).Since Typescript is a superset of JS (which does not have types), you can assign
null
tostring
as well. But if you want to opt out of this behaviour, in yourtsconfig
you can set,strictNullChecks
totrue
. Now you won't be able to assignnull
to astring
variable.Yeah. Cool.
Though, I only wish there was a way to use TS in the browser natively, I know it has to be "converted" to JS, but like, why can't we just have it interpreted like JS, and have that as another option? It'd save a hassle.
I would love that as well.. :D
I mean, the script tag NEEDS another use, bc outside if js, it's useless.
If I knew how to make, or modify a browser, I wold make such a thing.
#NativeTSSupport