I am creating a d.ts file for webgl-utils.js from google
I have a problem with one of the last lines where the method in the global object is "decapitated" (I think this is the correct terminology)
The problem line reads:
window.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function FrameRequestCallback */ callback, /* DOMElement Element */ element) { window.setTimeout(callback, 1000/60); }; })();
How can I declare this in my typescript file so that I don't get compilation errors when using the function:
function tick() { requestAnimFrame(tick); drawScene(); }
I tried it now:
interface window { requestAnimFrame(): any; }
But this does not fix the error:
The name 'requestAnimFrame' does not exist in the current scope
Toad
source share