Mascara: Next Generation JavaScript compiler

Try it Download Buy About Documentation Blog Contact

Parameterized Types

A parameterized type defines one or more type parameters, which can be instantiated at compile time. This is equivalent to what is called generics in Java and C#. Classes and functions can be parameterized.

Example:

class Point.<T> {
  var x: T, y: T;
}
var p = new Point.<double>;
p.x = 3.0;
p.y = 5.0;

X Try!
ECMAScript 6 Generated JavaScript

Translating...
Show compiler settings