Let´s assume, we need to access some DOM variables like navigator and location.

And we want to do that in typescript. That´s mean we have to make sure these Windows Objects are declared in our Environment and that we are working with the right Types.

For that, we have to add option to our tsconfig.json file.

Add dom to compilerOptions.lib array like here:

{
  "compilerOptions": {
        "lib": [
            "dom"
        ]
  }
}

This option will add necessary typings for DOM API.

lib.ts file

By Shabazz

Software Engineer, MCSD, Web developer & Angular specialist

Leave a Reply

Your email address will not be published. Required fields are marked *