0

I have code based on this questions answer, but the problem is that they simply use javascript. I am in a Typescript environment, and can't simply make things up out of thin air. I must type them, and I must know where they're coming from, and how they got there. The pieces of code that are causing issues are -

var saveBlob = navigator.webkitSaveBlob || navigator.mozSaveBlob || navigator.saveBlob; 

and

var urlCreator = window.URL || window.webkitURL || window.mozURL || window.msURL;

Typescripts lib.d.ts doesn't have any of those parameters defined on the base objects, and simply adding them to the lib.d.ts file doesn't appear to have any affect. Does anyone know how to fix this issue for Typescript users?

P.S. trying to circumvent this by simply using window.location() or window.open() is not an option. We must go through Angulars $http service to enforce an authorized API call that is wrapped with all of our decorated layers for tracking and loggin.

Community
  • 1
  • 1
Paul
  • 11
  • 2

1 Answers1

1

Typescripts lib.d.ts doesn't have any of those parameters defined on the base objects, and simply adding them to the lib.d.ts file doesn't appear to have any affect. Does anyone know how to fix this issue for Typescript users?

Don't add this to lib.d.ts. Add this to a new "global a.d.ts" file in your project :

interface Window {
    msURL: string;
}
// so on
basarat
  • 261,912
  • 58
  • 460
  • 511
  • Except... what are those? I guess not including all the code is coming back to bite me in the butt now. Let me edit. – Paul Jun 23 '15 at 13:29