JSFiddle - React, Tailwind, and code Playground

by jgarrido

TypeScript

const zoomOpts = {
  duration: 1.5,
  offset: [0, -90, 0]
};

class HeadingPitchRange {
	constructor(heading?: number, pitch?: number, range?: number) {
    this.heading = heading || 0;
    this.pitch = pitch || 0;
    this.range = range || 0;
    
    return {
      heading: this.heading,
      pitch: this.pitch,
      range: this.range
    };
  }
}

function doSomething(opts) {
	console.info("doSomething()", opts);
  opts.offset = new HeadingPitchRange(...opts.offset);
  console.info("opts.offset:", opts);
}

doSomething(zoomOpts);