I am attempting to include when.js (a public Promise library on github that can be found
here) as a property of Cesium (a public 3-D modelling framework described
here) in a Typescript definition file I have for the Cesium library. This is because I am trying to convert some Javascript files from a project that utilizes Cesium to Typescript, and the Cesium.js code that is referenced has the below code snippet included. I am at a loss at how to declare when.js in the d.ts file, however. It doesn't appear to be a class, and I don't think it's an interface. How should I go about this property - what kind of object is it?
(function(define) { 'use strict';
define('ThirdParty/when',[],function () {
var reduceArray, slice, undef;
when.defer = defer;
function when(promiseOrValue, onFulfilled, onRejected, onProgress) {
return resolve(promiseOrValue).then(onFulfilled, onRejected, onProgress);
}
What I have tried:
Currently I can get code referencing this to work if I declare a class called "when" in the Cesium.d.ts file I have. The only problem is that in this case "when" is a constructor, but as is clearly defined in the code snippet, the function "when" returns a Promise.