Reputation: 2844
I declared an Interface ElementStatic
and a variable implementing it:
interface ElementStatic {
new(s: string, s2: any): Element;
}
declare var Element: ElementStatic
But the compiler complains:
Subsequent variable declarations must have the same type. Variable 'Element' must be of type '{ new (): Element; prototype: Element}', but here as type 'ElementStatic'
.
Which means to me: somewhere in my code, there must be a declaration of Element
with the type given. But there is none, at least I cannot find it. What can I do?
Upvotes: 0
Views: 888
Reputation: 250326
The declaration of Element
is not in your code it's in lib.d.ts
(or a variant of it) the default library for Typescript.
I found this out by pressing F12
in Visual Studio Code, the popup, will list all declaration locations.
Upvotes: 2