Microsoft Research offers a new TypeScript compiler variant called Safer TypeScript:
http://research.microsoft.com/en-us/downloads/b250c887-2b79-4413-9d7a-5a5a0c38cc57/
I could not find any documentation on it, and I was unable to install it into my TypeScript 1.0 system, since it requires TypeScript 0.9.5.
What are the differences between TypeScript and Safer TypeScript?
TypeScript will produce a compile-time error if our code does not have that logical outcome. Plus, this code handles and clearly reports three separate error conditions that the any code does nothing about. Using unknown and type narrowing forced us to come face-to-face with and handle these error conditions.
TypeScript is not a perfect language by any means; it has flaws and can have security issues when used incorrectly. However, it is more secure than JavaScript, and when deciding between the two, TypeScript is what you should choose.
There are three main primitives in JavaScript and TypeScript. boolean - true or false values. number - whole numbers and floating point values. string - text values like "TypeScript Rocks"
TypeScript is no different from JavaScript in its purpose but is used for developing large applications. TypeScript trans compiles (source to source compilation) to JavaScript. It follows an object-oriented programming language structure and supports features like classes, interfaces, namespaces, and inheritance.
The main difference is that TS* features runtime type checking as well as static type checking, whereas standard TypeScript is only a design and compile time feature.
This means plain JavaScript code that calls your TS* code will receive type errors when passing invalid types from untrusted code. The general idea is to prevent security problems which are often caused by attacks based on unchecked types.
More information can be found here:
http://research.microsoft.com/en-us/um/people/nswamy/papers/gradual-typing-embedded-securely-in-javascript-draft.pdf
I have also written a slightly less detailed summery of TS*.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With