"Target call contains no signature" for calling super () without a typing file

I am trying to get Polymer 2.0 to work with Typescript and run into problems creating a constructor where libraries, including Polymer 2, do not set the correct typing file. In the simplest case:

class MyView1 extends Polymer.Element {
    public static is = 'my-view1';

    constructor() {
        super(); // [ts] Call target does not contain any signature
    }
}

To compile it without a constructor, I did declare var Polymer: any;in the main file .d.ts.

Now I have two questions:

  • How (if at all) can I make Typescript ignore this and just assume there is a super constructor that it can call?
  • How (if at all) to declare a typing file that contains a signature for a superclass? I could not find suitable documentation for this (and the various use cases I have used so far).
+4
1

, Element:

declare var Polymer: {
    Element: {
        new ();
    }
};

*.d.ts. . .

+2

Source: https://habr.com/ru/post/1680881/


All Articles