I’m new to typescript and I’m trying to do some interface declaration merging. There is this interface from lib.dom.d.ts that is automatically imported, and there is the same interface in a @types package that I’m using in my project. I’m trying to merge them, but when I import the one from @types it is actually overwriting the other.
Interface Navigator from lib.dom.d.ts
I’ve tried importing Navigator from the @types package in my global.d.ts file:
import {Navigator} from “three”
Expected the interfaces to merge but getting only the above one.
I’ve gone through the typescript tutorials, and I know how to extend the lib.dom.d.ts Navigator myself. I suppose I can always do that if what I want is not possible:
// global.d.ts
interface Navigator {
properties_from_type: any;
}
I also know how to extend the interface from the @types package:
import {Navigator} from 'three';
declare module 'three' {
interface Navigator {
properties_from_dom: any;
}
}
But ultimately, I just want to merge the lib.dom.d.ts one with the ones from @types package. Seems like it should be simple right?