Typescript – using documentMode with typescript

typescript

I check if the browser is ie by:

function isBrowserIE() {
  return window.document.documentMode;
}

Typescript raises an error:

Error TS2339: Property 'documentMode' does not exist on type 'Document'.

This is due to the change made in typescript compiler at version 1.5 :

Properties documentMode, parentWindow, createEventObject are removed from type Document

How can i get rid from the error?

Best Answer

I've used bracket notation to get rid of the error:
document['documentMode']