I'm confused about merging with lib.d.ts. I am trying to add a property to Navigator. I think I need to merge with Navigator interface that is declared in lib.d.ts. I am using TS 2.0.6.
Here is my code:
let lang = navigator.language || navigator.userLanguage;
Which produces this error:
Property 'userLanguage' does not exist on type 'Navigator'.
I've tried making a merge happen this way:
interface Navigator {
userLanguage: string;
}
But, still cannot find the userLanguage property...
Can someone help me understand where and how I can merge with lib.d.ts declarations?
Thank-you
Turns out I did not realize that I had to create a navigator.d.ts file with the interface in it. Once that file was created in my project, errors went away.
I did not need to use the ///< reference ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With