Skip to main content

Home/ Groups/ Group intelligence
Cédric Lampron

TypeScript - 2 views

TypeScript

TypeScript

started by Cédric Lampron on 08 Jun 15 no follow-up yet
Cédric Lampron

| The Definitive TypeScript Guide | Blog | SitePen - 1 views

  • optional parameters, default argument values, rest parameters, and fat arrow functions
    • Cédric Lampron
       
      Default : "exclusive?"
  • Optional parameters can now be defined by suffixing a parameter identifier with a question mark:
  • An optional parameter
  • ...9 more annotations...
  • 123function getRange(max, min = 0, exclusive = false) {  // ...}
    • Cédric Lampron
       
      Optional Parameter
  • ypeScript also adds support for a final variadic ...rest parameter, which collects any extra arguments passed to the function into a single named array:
  • 23function publish(topic, ...args):void {  // ...}
    • Cédric Lampron
       
      calling publish('/foo', 'a', 'b', 'c') would cause topic to be a string '/foo' and args to be an array [ 'a', 'b', 'c' ].
  • 12var x, y;[x, y] = [10, 20];
  • any, number, string, boolean, and void (i.e. null or undefined)
  • TypeScript allows complex types
  • the properties of each object are compared
  • interface IPoint {  x: number;  y: number;} var point: IPoint;var point2: IPoint;
  • interface IPoint3d extends IPoint {  z: number;}
Cédric Lampron

Floating point - Wikipedia, the free encyclopedia - 1 views

1 - 3 of 3
Showing 20 items per page