Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • As I suspected in my last edit of the question then. and with that I think we can call this question answered. Commented Nov 15, 2012 at 23:31
  • 80
    More formally, a class implementing an interface is a contract on what an instance of the class has. Since an instance of a class won't contain a construct signature, it cannot satisfy the interface. Commented Nov 15, 2012 at 23:57
  • 23
    It would be really nice to have this highlighted in TypeScript's handbook (documentation). Commented Aug 18, 2015 at 19:47
  • 1
    @RyanCavanaugh, say you have an array of interfaces const objs: ComesFromString[] = [MadeFromString, AnotherOne, MoreString]; Now, how would I go about creating instances from those? say in a loop: _.each(objs, (x) => makeObj(x)? This will throw an error since x is of type ComesFromString and doesn't have a constructor. Commented Aug 20, 2016 at 17:40
  • 1
    ComesFromString is not the correct type annotation for objs as it implies each objs element is an instance of that type, not a constructor for it. You want objs: StringConstructable[] Commented Aug 21, 2016 at 20:57