Nitin Bhardwaj

Nitin Bhardwaj

  • NA
  • 15.9k
  • 13m

Constructor Overloading in TypeScript

Nov 1 2012 11:35 AM
Hi,
Can we constructor overloading in TypeScript?

Answers (1)

0
Vulpes

Vulpes

  • 0
  • 96k
  • 2.6m
Nov 1 2012 12:42 PM
Well, you can overload constructors but the problem is that only one of the constructors can have an implementation!

If follows that the latter must have a signature which is compatible with all of the other constructors.

It seems to me that there's little point in defining additional constructors in these circumstances.

There are some examples in this thread:

http://stackoverflow.com/questions/12702548/constructor-overload-in-typescript


Accepted Answer