I need to define a Element
interface in my code:
interface Element {
// my declaration
}
But, I also need to access the Element
type of lib.dom.d.ts
.
How could I do?
A special declaration file lib. d. ts ships with every installation of TypeScript. This file contains the ambient declarations for various common JavaScript constructs present in JavaScript runtimes and the DOM. This file is automatically included in the compilation context of a TypeScript project.
use this
export type DOMElement = globalThis.Element
lib.dom
has already imported Element
type for you, you can explicitly access that from globalThis
Export your interface first to be able to import it because all definition files should export types and interfaces.
export interface Element {
// my declaration
}
And then import as will
import {Element} from 'path'
import {Element as ABC} from 'path'
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